#include using namespace std; long solve(long n) { long ans = n; int root = (int)sqrt(n); while(n != 1) { for(int i=2;i<=root;i++) { if(n%i==0) { ans += n/i; n = n/i; root = sqrt(n); break; } else if(i==root) return ans+1; } if(root<2) return ans+1; } return ans; } long longestSequence(vector a) { // Return the length of the longest possible sequence of moves. long ans = 0; for(int i=0;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; }