#include using namespace std; long longestSequence(vector a) { // Return the length of the longest possible sequence of moves. long total=0; vector :: iterator itr; for(itr=a.begin(); itr!=a.end(); itr++) { long n=*itr; long sum=n; while(n!=1) { int flag=0; for(long i=2; i<=sqrt(n); i++) { if(n%i==0) { n=n/i; sum+=n; flag=1; break; } } if(flag==0) { n=1; sum+=1; } } total+=sum; } return total; } 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; }