#include #define MAXPRIMEDIVISOR 1000000 #define MAXNUMBER 100 using namespace std; int divisors[MAXNUMBER][MAXPRIMEDIVISOR+1] = {0}; int moves(int n) { if(n == 1) return 1; int root = sqrt(n); int max = 1+n, maxDivisor = 1; for(int l = 2;l <= root;l++) { if(n%l == 0) { int tmp = 1+l*moves(n/l); int tmp1 = 1+(n/l)*moves(l); if(tmp>max) max = tmp; if(tmp1>max) max = tmp1; } } return max; } long longestSequence(vector a) { // Return the length of the longest possible sequence of moves. long ans = 0; for(int l = 0;l < a.size();l++) { ans+=moves(a[l]); } return ans; } 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; }