#include using namespace std; long longestSequence(vector arr) { long et = 0; for(auto i : arr) { if(i == 1) { et += (1); continue; } //cout << " I : " << i << endl; vector ans; int flag = 0; while(i % 2 == 0) { i /= 2; //flag = 1; ans.push_back(2); } //cout << " I : " << i << endl; for(long j = 3; j <= sqrt(i); j += 2) { while(i % j == 0) { //if(j == i/j) // ans.push_back(j); //else //{ ans.push_back(j); //} i /= j; } } if(ans.size() == 0) { et += (i+1); continue; } if(i > 2) ans.push_back(i); /*for(long k : ans) cout << "A : " << k << ' '; cout << endl;*/ long long pro = 1, sum = 1; for(long j = ans.size()-1; j >= 0; j--) { pro *= ans[j]; sum += pro; } //cout << "S : " << sum << endl; et += sum; } return et; } int main() { int n; cin >> n; vector arr(n); for(int a_i = 0; a_i < n; a_i++) { cin >> arr[a_i]; } long result = longestSequence(arr); cout << result << endl; return 0; }