#include using namespace std; unsigned long long int d=0,ano,abc,temp; long long longestSequence(vector a) { // Return the length of the longest possible sequence of moves. long long int ans=0; for(int i=0;i0) { ans+=temp; if(temp == 1) break; if(temp%j != 0){ abc = sqrt(temp); ano = j+1; while(ano <= abc){ if(temp % ano ==0) break; ano++; } if(ano<=abc) j=ano; else j=temp; } temp = temp / j; } } else { if(a[i]>1) ans+=a[i]+1; else ans+=a[i]; } } 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]; } unsigned long long result = longestSequence(a); cout << result << endl; return 0; }