#include #include using namespace std; long longestSequence(vector a) { // Return the length of the longest possible sequence of moves.int i; long int ans=0; for(int p=0;p m; if(a[p]==1){ ans+=1; continue; } long int i=2,x=a[p],k=1; while(i1){ if(x%i==0){ if(m.find(i)==m.end()){ m.insert(make_pair(i,i+1)); } if(k!=1){ m.insert(make_pair(i*k,m[k]*i+1)); } k=k*i; x=x/i; } else i++; } if(m.size()==0) ans+=a[p]+1; else ans+=m[a[p]]; } 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; }