#include #include #include #include #include using namespace std; bool IsPrime[1000005]; int Pri[200001],PriN; void FindPrime ( int MaxN ) { for( int i = 2 ; i <= MaxN ; ++i ){ if( !IsPrime[ i ] ) Pri[ PriN++ ]=i; for(int j=0;j MaxN ) break; IsPrime[ i * Pri[ j ] ] = 1; if( i % Pri[ j ] == 0 ) break; } } } long long gao(long long x) { long long ans = 1; for (int i = 0; i < PriN; i++) { if (x % Pri[i] == 0) { while (x % Pri[i] == 0) { ans += x; x /= Pri[i]; } } } if (x > 1) ans += x; return ans; } int main() { FindPrime(1000001); int n; cin >> n; vector a(n); long long ans = 0; for (int i = 0; i < n; i++) { cin >> a[i]; ans += gao(a[i]); } cout << ans << endl; /* Enter your code here. Print output to STDOUT */ return 0; }