/* ##################################################### # I will win.. maybe not immediately but definitely # ##################################################### */ #include using namespace std; //save time #define endl '\n' typedef long long ll; //for sorting #define all(a) a.begin(),a.end() //Constants #define PI 3.141592653593 #define MOD 1000000007LL #define EPS 0.000000001 //loops #define REP(i,n) for(int i=0;i<(n);++i) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define DFOR(i,a,b) for(int i=(a);i>=(b);--i) //vectors #define vi vector #define vll vector #define vii vector > #define pb push_back //pairs #define pi pair #define pll pair #define mp make_pair #define F first #define S second //fast I/O #ifndef _WIN32 #define getchar getchar_unlocked #define putchar putchar_unlocked #endif #define gc getchar #define pc putchar #define scan getFoo //If using cin and cout #define IOS ios::sync_with_stdio(false) #define TIE cin.tie(NULL) //queue #define di deque #define qi queue #define PQ priority_queue //general #define E empty() //Input methods template void getFoo(T &x){ x=0; register char c=gc(); for(;c<48 || c>57;c=gc()); for(;c>47 && c<58;c=gc()) x=(x<<1)+(x<<3)+c-48; } template void getFoo(T1 &x,T2 &y){ getFoo(x); getFoo(y); } template void getFoo(T1 &x,T2 &y,T3 &z){ getFoo(x); getFoo(y); getFoo(z); } //Declare all variables and methods needed between this comment and the next one(OCD lol) map dp; ll greatestPrime(ll n){ ll factor=1; for(ll i=2;i<=sqrt(n);++i) if(n%i==0){ factor=i; break; } if(factor==1) return n; else{ while(n%factor==0) n/=factor; if(n==1) return factor; else return greatestPrime(n); } } ll getMax(ll curr){ if(!dp[curr]){ ll primeFact=greatestPrime(curr); dp[curr]=1+primeFact*getMax(curr/primeFact); } return dp[curr]; } //Code goes here !! int main(){ IOS; TIE; int n; cin>>n; ll ans=0; dp[1]=1; while(n--){ ll temp; cin>>temp; ans+=getMax(temp); } cout<