#include <bits/stdc++.h>
#define ii pair<int, int>
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define pb push_back
#define ll long long
#define ull unsigned long long
#define TASK "1"
using namespace std;
const int N = 99999990;
const ll oo = 1e18;
const int mod = 1e9 + 7;
const char idx[27] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
int f[N], s[N];
vector<int> v;
int p(int n)
{
int cnt = 1;
for(auto i : v){
if(i * i > n) break;
int cur = 0;
if(n % i == 0){
while(n % i == 0) n /= i, cur++;
cnt *= (cur + 1);
}
}
if(n != 1) cnt <<= 1;
return cnt;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
if(fopen(TASK".inp", "r")){
freopen(TASK".inp", "r", stdin);
freopen(TASK".out", "w", stdout);
}
int n;
cin >> n;
ll res = 0;
for (int i = 2; i * i <= 10000; i++){
if(!s[i]){
for(int j = i * i; j <= 10000; j += i){
s[j] = true;
}
}
}
for (int i = 2; i <= 10000; i++) if(!s[i]) v.pb(i);
while(n--){
int a;
cin >> a;
if(!f[a]) f[a] = p(a);
res += 1LL * a * f[a];
}
cout << res;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CgojZGVmaW5lIGlpIHBhaXI8aW50LCBpbnQ+CiNkZWZpbmUgYWxsKHYpIHYuYmVnaW4oKSwgdi5lbmQoKQojZGVmaW5lIGZpIGZpcnN0CiNkZWZpbmUgc2Ugc2Vjb25kCiNkZWZpbmUgcGIgcHVzaF9iYWNrCiNkZWZpbmUgbGwgbG9uZyBsb25nCiNkZWZpbmUgdWxsIHVuc2lnbmVkIGxvbmcgbG9uZwojZGVmaW5lIFRBU0sgIjEiCgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IE4gPSA5OTk5OTk5MDsKY29uc3QgbGwgb28gPSAxZTE4Owpjb25zdCBpbnQgbW9kID0gMWU5ICsgNzsKCmNvbnN0IGNoYXIgaWR4WzI3XSA9IHsnQScsICdCJywgJ0MnLCAnRCcsICdFJywgJ0YnLCAnRycsICdIJywgJ0knLCAnSicsICdLJywgJ0wnLCAnTScsICdOJywgJ08nLCAnUCcsICdRJywgJ1InLCAnUycsICdUJywgJ1UnLCAnVicsICdXJywgJ1gnLCAnWScsICdaJ307CgppbnQgZltOXSwgc1tOXTsKdmVjdG9yPGludD4gdjsKCmludCBwKGludCBuKQp7CiAgICBpbnQgY250ID0gMTsKICAgIGZvcihhdXRvIGkgOiB2KXsKICAgICAgICBpZihpICogaSA+IG4pIGJyZWFrOwogICAgICAgIGludCBjdXIgPSAwOwogICAgICAgIGlmKG4gJSBpID09IDApewogICAgICAgICAgICB3aGlsZShuICUgaSA9PSAwKSBuIC89IGksIGN1cisrOwogICAgICAgICAgICBjbnQgKj0gKGN1ciArIDEpOwogICAgICAgIH0KICAgIH0KICAgIGlmKG4gIT0gMSkgY250IDw8PSAxOwogICAgcmV0dXJuIGNudDsKfQoKaW50IG1haW4oKXsKICAgIGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOwogICAgY2luLnRpZShOVUxMKTsKICAgIGNvdXQudGllKE5VTEwpOwoKICAgIGlmKGZvcGVuKFRBU0siLmlucCIsICJyIikpewogICAgICAgIGZyZW9wZW4oVEFTSyIuaW5wIiwgInIiLCBzdGRpbik7CiAgICAgICAgZnJlb3BlbihUQVNLIi5vdXQiLCAidyIsIHN0ZG91dCk7CiAgICB9CgogICAgaW50IG47CiAgICBjaW4gPj4gbjsKICAgIGxsIHJlcyA9IDA7CiAgICBmb3IgKGludCBpID0gMjsgaSAqIGkgPD0gMTAwMDA7IGkrKyl7CiAgICAgICAgaWYoIXNbaV0pewogICAgICAgICAgICBmb3IoaW50IGogPSBpICogaTsgaiA8PSAxMDAwMDsgaiArPSBpKXsKICAgICAgICAgICAgICAgIHNbal0gPSB0cnVlOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQogICAgZm9yIChpbnQgaSA9IDI7IGkgPD0gMTAwMDA7IGkrKykgaWYoIXNbaV0pIHYucGIoaSk7CiAgICB3aGlsZShuLS0pewogICAgICAgIGludCBhOwogICAgICAgIGNpbiA+PiBhOwogICAgICAgIGlmKCFmW2FdKSBmW2FdID0gcChhKTsKICAgICAgICByZXMgKz0gMUxMICogYSAqIGZbYV07CiAgICB9CiAgICBjb3V0IDw8IHJlczsKICAgIHJldHVybiAwOwp9Cg==