#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define endl '\n'

using namespace std;

const int maxn = 3e6 + 3;

int n;
int cnt[maxn];
void read()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        int x;
        cin >> x;
        cnt[x]++;
    }
}

int d[maxn];
void solve()
{
    for (int i = 1; i < maxn; i++)
    if (cnt[i])
    for (int j = i + i; j < maxn; j += i)
    d[j]++;

    long long ans = 0;
    for (int i = 1; i < maxn; i++)
        if (cnt[i])
    {
        int cnt_big = 0;
        for (int j = i + i; j < maxn; j += i)
            cnt_big += cnt[j];

        ans += (long long)cnt_big * d[i];
    }

    cout << ans << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    read();
    solve();
}
