#include using namespace std; long moves(int a){ long ans=0; if(a==1)ans=1; else{int d,f=0; for(d=2;d a) { // Return the length of the longest possible sequence of moves. long sum=0,k=0;int i=0; while(i> 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; }