#include using namespace std; typedef unsigned long long ullong; //given a number n, determine if it is prime vector primeFactor(ullong n) { vector v; ullong d = 2; while (n > 1) { while (n % d == 0) { v.push_back(d); n /= d; } d++; if (d*d > n) { if (n > 1) { v.push_back(n); break; } } } return v; } ullong longestSequence(vector a) { // Return the length of the longest possible sequence of moves. ullong sum = 0; for (int i = 0; i < a.size(); i++) { if (a[i] == 1) { sum += 1; continue; } if (a[i] == 2) { sum += 3; continue; } sum += 1; ullong m = 1; vector factors = primeFactor(a[i]); for (long long j =factors.size()-1; j >=0 ; j--) { //cout << "n=" << n << "f=" << factors[j] << endl; m *= factors[j]; sum += m; } } 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]; } ullong result = longestSequence(a); cout << result << endl; return 0; }