#include #include using namespace std; long longestSequence(long n) { stack s; long moves=1; while (n%2 == 0) { s.push(2); n = n/2; } for (long i = 3; i <= sqrt(n); i = i+2) { while (n%i == 0) { s.push(i); n = n/i; } } if (n > 2) s.push(n); long temp=1; while(!s.empty()) { temp*=s.top(); moves+=temp; s.pop(); } return moves; } 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=0; for(int i=0;i