#include using namespace std; long check_prime(long numb){ for (long j = 2; j <=sqrt(numb); j++){ if (numb % j == 0){ return numb/j;}} return 1; } long longestSequence(vector a) { long sum=0,res; int flag; for(long i=0;i0){ if(a[i]%2==0){sum+=a[i];a[i]=a[i]/2;} else{res=check_prime(a[i]); if(a[i]==1){sum+=1;break;} if(res==1){sum+=a[i]+1;break;} else{sum+=a[i];a[i]=res;flag=0;} } } } return sum; } int main() { int n; cin >> n; vector a(n); for(int a_i = 0; a_i < n; a_i++){ cin >> a[a_i];} long result = longestSequence(a); cout << result << endl; return 0; }