#include using namespace std; int solv(vector A) { vector B; int g=0; for(int k=0;k A) { // Return the length of the longest possible sequence of moves modulo 10^9+7. static int l=0; vector B; int g=0; for(int k=0;k> n; vector a(n); for(int a_i = 0; a_i < n; a_i++){ cin >> a[a_i]; } int result = solve(a); cout << result << endl; return 0; }