#include using namespace std; long longestSequence(vector a,int n) { int sum=0,ans;int top=-1,num;int p,count=0; for(int i=0;iarr(25); while(num%2==0){ count++; num=num/2; top++; arr[top]=2; } for(int j=3;j<=sqrt(num);){ while(num%j==0){ count++; num=num/j; top++; arr[top]=j;}j=j+2;} if(num>2){ count++; top++; arr[top]=num;} if((arr[top])==(a[i])){ans=(a[i])+1;} if(arr[top]!=a[i]){ arr[top+1]=1; while(a[i]!=1){ p=arr[top]; ans=ans+(p*arr[top+1]); arr[top]=(arr[top])*(arr[top+1]); top--; a[i]=a[i]/p;} ans=ans+1;}} sum+=ans; ans=0;} return sum;// Return the length of the longest possible sequence of moves. } 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,n); cout << result << endl; return 0; }