#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long
#define endl "\n"
#define all(x) (x).begin(),(x).end()
const int MOD = 1e9+7;
const int mxN = 1e6+3;
int phi[mxN+1];
// This is my previously implemented function, I hope there is no mistake in this
void computeTotient(int n){
for (int i=1; i<=n; i++)
phi[i] = i;
for (int p=2; p<=n; p++){
if (phi[p] == p) {
phi[p] = p-1;
for (int i = 2*p; i<=n; i += p){
phi[i] = (phi[i]/p) * (p-1);
}
}
}
}
int32_t main(){
IO;
int nT = 1;
cin >> nT;
int val[nT];
int mx = 0;
for(int i = 0; i < nT; ++i){
cin >> val[i];
mx = max(mx, val[i]);
}
computeTotient(mx + 1);
for(int i = 2; i <= mx; ++i){
phi[i] += phi[i - 1];
}
int ans = 0;
// I used #define , so all int(s) are actually long long(s). Rather than doing -1 every time , I did -nT after for loop
int countzeroes = 0;
for(int i = 0; i < nT; ++i){
if(val[i] == 0)countzeroes++;
ans += (2ll * phi[val[i]]);
}
ans -= nT;
ans += countzeroes;
cout << ans << endl;
return 0;
}
I3ByYWdtYSBHQ0Mgb3B0aW1pemUoIk9mYXN0IikgIAojcHJhZ21hIEdDQyB0YXJnZXQoImF2eCxhdngyLGZtYSIpCiNpbmNsdWRlPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgSU8gaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7Y2luLnRpZShOVUxMKTtjb3V0LnRpZShOVUxMKQojZGVmaW5lIGludCBsb25nIGxvbmcgCiNkZWZpbmUgZW5kbCAiXG4iCiNkZWZpbmUgYWxsKHgpICh4KS5iZWdpbigpLCh4KS5lbmQoKQpjb25zdCBpbnQgTU9EID0gMWU5Kzc7CmNvbnN0IGludCBteE4gPSAxZTYrMzsKCmludCBwaGlbbXhOKzFdOyAKLy8gVGhpcyBpcyBteSBwcmV2aW91c2x5IGltcGxlbWVudGVkIGZ1bmN0aW9uLCBJIGhvcGUgdGhlcmUgaXMgbm8gbWlzdGFrZSBpbiB0aGlzCnZvaWQgY29tcHV0ZVRvdGllbnQoaW50IG4peyAgCiAgICBmb3IgKGludCBpPTE7IGk8PW47IGkrKykgCiAgICAgICAgcGhpW2ldID0gaTsgCiAgICBmb3IgKGludCBwPTI7IHA8PW47IHArKyl7IAogICAgICAgIGlmIChwaGlbcF0gPT0gcCkgeyAKICAgICAgICAgICAgcGhpW3BdID0gcC0xOyAKICAgICAgICAgICAgZm9yIChpbnQgaSA9IDIqcDsgaTw9bjsgaSArPSBwKXsgCiAgICAgICAgICAgICAgIHBoaVtpXSA9IChwaGlbaV0vcCkgKiAocC0xKTsgCiAgICAgICAgICAgIH0gCiAgICAgICAgfSAKICAgIH0KfQoKaW50MzJfdCBtYWluKCl7CiAgICBJTzsKICAgIAogICAgaW50IG5UID0gMTsKICAgIGNpbiA+PiBuVDsKICAgIGludCB2YWxbblRdOwogICAgaW50IG14ID0gMDsKICAgIGZvcihpbnQgaSA9IDA7IGkgPCBuVDsgKytpKXsKICAgICAgICBjaW4gPj4gdmFsW2ldOwogICAgICAgIG14ID0gbWF4KG14LCB2YWxbaV0pOwogICAgfQogICAgY29tcHV0ZVRvdGllbnQobXggKyAxKTsKICAgIGZvcihpbnQgaSA9IDI7IGkgPD0gbXg7ICsraSl7CiAgICAgICAgcGhpW2ldICs9IHBoaVtpIC0gMV07CiAgICB9CiAgICBpbnQgYW5zID0gMDsKICAgIC8vIEkgdXNlZCAjZGVmaW5lICwgc28gYWxsIGludChzKSBhcmUgYWN0dWFsbHkgbG9uZyBsb25nKHMpLiBSYXRoZXIgdGhhbiBkb2luZyAtMSBldmVyeSB0aW1lICwgSSBkaWQgLW5UIGFmdGVyIGZvciBsb29wCiAgICBpbnQgY291bnR6ZXJvZXMgPSAwOwogICAgZm9yKGludCBpID0gMDsgaSA8IG5UOyArK2kpewogICAgICAgIGlmKHZhbFtpXSA9PSAwKWNvdW50emVyb2VzKys7CiAgICAgICAgYW5zICs9ICgybGwgKiBwaGlbdmFsW2ldXSk7CiAgICB9CiAgICBhbnMgLT0gblQ7CiAgICBhbnMgKz0gY291bnR6ZXJvZXM7CiAgICBjb3V0IDw8IGFucyA8PCBlbmRsOwogICAgcmV0dXJuIDA7Cn0K