#include using namespace std; const int maxN = 1e2+10; int N; long long ans; vector E; long long cal(long long x) { if (x == 1) return 1; E.clear(); long long tmp = x; for (int i=2; 1ll*i*i <= tmp; i++) while (tmp%i == 0) { E.push_back(i); tmp /= i; } if (tmp > 1) E.push_back(tmp); sort(E.begin(), E.end(), greater()); long long res = 0, num = 1; for (int i=0; i < E.size(); i++) { res += num; num *= E[i]; } return res + x; } int main() { cin >> N; for (int i=0; i < N; i++) { long long x; cin >> x; ans += cal(x); } cout << ans; }