#include #define MAX 1000001 using namespace std; vector primes; bool p[MAX]; void getPrimes() { int i, j; for(i=3;i a) { // Return the length of the longest possible sequence of moves. long ans=0; int i=0; getPrimes(); for(i=0;i1)//x is prime ans+=x; ans+=1;//initial breaking } return ans; } int main() { int n; cin >> n; vector a(n); for(int a_i = 0; a_i < n; a_i++){ cin >> a[a_i]; } long result = longestSequence(a); cout << result << endl; return 0; }