#include using namespace std; bool prime(long long int i){ if(i==1) return false; if((i==2)||(i==3)) return true; if((i%2==0)||(i%3==0)) return false; else{ for(long long int j=5 ; j*j<=i ; j+=6) if((i%j==0)||(i%(j+2)==0)) return false; } return true; } int main(){ int n; cin>>n; long long x,ans=0,total=0; while(n--){ ans = 0; cin>>x; if(x==1){ ans += 1; total+=ans; continue; } while(x>0){ if(x%2==0 && x!=2){ ans += x; x/=2; } else if(prime(x)){ ans += (x+1); break; } else if(x%2==1){ int i;for(i=3;i<=(x/2);i+=2){ if(x%i==0) break; } ans += x; x /= i; } } //cout << ans << " "; total += ans; } cout << total << endl; return 0; }