#include using namespace std; typedef pair ii; typedef unsigned long long ull; typedef pair uli; #define pb push_back #define sqr(x) ((x)*(x)) #define DEBUG(x) std::cerr << x #define DEBUG2(x) std::cerr << x << '\n' ull Solve(ull x) { vector primes; ull i = 2; while (i * i <= x) { if (x % i == 0) { int cnt = 0; while (x % i == 0) { ++cnt; x /= i; } primes.pb({i, cnt}); } ++i; } if (x > 1) primes.pb({x, 1}); ull tmp = 1; for(uli u: primes) { for(int j = 1; j <= u.second; ++j) tmp = (tmp * u.first) + 1; } return tmp; } ull longestSequence(vector a) { // Return the length of the longest possible sequence of moves. long res = 0; for(long &x: a) { res += Solve(x); } return res; } int main() { int n; cin >> n; vector a(n); for(int a_i = 0; a_i < n; a_i++){ cin >> a[a_i]; } ull result = longestSequence(a); cout << result << endl; return 0; }