#include #include using namespace std; unordered_mapm; long int calc(long int t){ if (m.find(t) != m.end()){ return m[t]; } long int ans = 0,temp1,temp,temp2; long int sqr = sqrt(t); for (long int i=2;i<=sqr;i++){ if (t%i == 0){ temp1 = calc(i); m[i] = temp1; temp = 1 + (t/i)*(temp1); if (temp > ans){ ans = temp; } temp1 = calc(t/i); m[t/i] = temp1; temp = 1 + (i)*(temp1); if (temp > ans){ ans = temp; } } } if (ans == 0){ ans = t + 1; } return ans; } int main(){ m[1] = 1; m[2] = 3; m[3] = 4; int n; long int temp; long long int ans = 0; cin >> n; while (n > 0){ cin >> temp; ans = ans + calc(temp); n = n - 1; } cout << ans << endl; return 0; }