#include using namespace std; void primeFactors(long n,vector&prime){ while(n%2 == 0){ prime.push_back(2); n = n/2; } for(int i=3;i<=sqrt(n);i=i+2){ while(n%i==0){ prime.push_back(i); n=n/i; } } if(n>2){ prime.push_back(n); } } long longestSequence(vector a) { // Return the length of the longest possible sequence of moves. long ans=0; for(int i=0;iprime; primeFactors(a[i],prime); prime.push_back(1); long mul=prime[0]; if(mul!=1){ ans+=(mul+1)*(a[i]/mul); mul*=prime[1]; } else{ ans+=1; } for(int j=1;j> 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; }