#include #include #include #include #include using namespace std; typedef unsigned long long ullong; /*void primeFactors(ullong i, vector& buf) { buf.resize(0); if (i == 1) { buf.push_back(1); } else { while(!(i & 1)) { i >>= 1; buf.push_back(2); } } }*/ ullong f(ullong i) { if (i == 1) return 1; ullong nParts = i; //ulong partSize = 1; ullong nMoves = i; while(!(i & 1)) { i >>= 1; nParts >>= 1; nMoves += nParts; //partSize <<= 1; } for (ullong f = 3; (f * f) <= i; f += 2) { while ( (i % f) == 0) { i /= f; nParts /= f; nMoves += nParts; //partSize /= f; } } if(nParts > 1) nMoves += 1; return nMoves; } int main() { int n; cin >> n; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } ullong nMoves = 0; for (ullong i: a) { nMoves += f(i); //cerr << f(i) << endl; } cout << nMoves; /* Enter your code here. Print output to STDOUT */ return 0; }