#include using namespace std; #define MOD 1000000007 #define PB push_back #define INS insert #define MP make_pair #define LL long long int #define SS string #define VG vector< vector > #define VI vector #define VL vector LL ans,sz; VL pr; #define TRACE #ifdef TRACE #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template void __f(const char* name, Arg1&& arg1){ cerr << name << " : " << arg1 << std::endl; } template void __f(const char* names, Arg1&& arg1, Args&&... args){ const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...); } #else #define trace(...) #endif LL XpowerY(LL x, LL y, LL m){ LL ans=1; x=x%m; while(y>0){ if(y%2==1) ans=(ans*x)%m; x=((x%m)*(x%m))%m; y=y>>1; } return ans%m; } void SieveOfEratosthenes(LL n){ bool prime[n+1]; memset(prime, true, sizeof(prime)); for (LL p=2; p*p<=n; p++){ if (prime[p] == true){ for (LL i=p*2; i<=n; i += p) prime[i] = false; } } for (LL p=2; p<=n; p++){if (prime[p]){pr.PB(p);}} } LL lpf(LL x){ LL ma=-1,ind=0,temp=x; if(x<=1000033) ind=1; if(x == 1) return 0; if(ind == 1){ for(int i=sz-1;i>-1;i--){ if(x%pr[i] == 0) return pr[i]; } }else{ for(int i=sz-1;i>-1;i--){ while(temp%pr[i] == 0) {temp/=pr[i];} }return temp; }return 0; } LL maxPrimeFactors(LL n){ LL maxPrime = -1; while (n % 2 == 0) { maxPrime = 2; n >>= 1; // equivalent to n /= 2 } for (int i = 3; i <= sqrt(n); i += 2) { while (n % i == 0) { maxPrime = i; n = n / i; } } if (n > 2) maxPrime = n; return maxPrime; } LL func(LL x){ LL temp = maxPrimeFactors(x), one=1; if(x == temp) return x+1;return 1 + temp*func(x/temp); } int main(){SieveOfEratosthenes(1000033);sz=pr.size(); LL x,n;cin >> n; for(LL i=0;i> x; if(x==1) ans++; else ans+=func(x); }cout << ans << endl; return 0; }