#include using namespace std; bool prime(long num) { int count=0; if(num==0 || num==1) return false; else if(num==2 || num==3) return true; else { int x=sqrt(num); for(int i=2;i<=x;i++) { if(num%i==0) { break; } count++; } if(count==x-1) return true; else return false; } } long longestSequence(vector a) { vectorv; for(int i=0;i1) { if(a[i]%2==0) { sum=sum+a[i]; a[i]=a[i]/2; } else if(a[i]%2==1 && prime(a[i])==false ) { long b; for(int j=sqrt(a[i]);j>=3;j--) { if(a[i]%j==0) { b=a[i]/j; } } sum=sum+a[i]; a[i]=b; } else if(prime(a[i])==true && a[i]!=2) { sum=sum+a[i]; a[i]=1; } } v.push_back(sum+1); } long lon=0; for(int i=0;i> 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; }