#include <bits/stdc++.h>

using namespace std;
using ll = int64_t;

set<int> divisors(int M) {
    set<int> r;
    for (int i = 1; i * i <= M; ++i) {
        if (M % i != 0) continue;
        r.insert(i);
        r.insert(M / i);
    }
    return r;
}

int N;
vector<int> A;

int gcd(int a, int b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}

int solve() {
    int const L = *min_element(A.begin(), A.end());
    map<int,int> mp;
    for (auto a : A) {
        auto ds = divisors(a);
        for (auto v : ds) {
            if (v > L) continue;
            if (mp.count(v)) {
                mp[v] = gcd(mp[v],a);
            } else {
                mp[v] = a;
            }
        }
    }
    int ans = 0;
    for (auto e : mp) {
        int v, a;
        tie(v, a) = e;
        if (v == a) ++ans;
    }
    return ans;
}

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

    cin >> N;
    A.assign(N, 0);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    cout << solve() << endl;

    return 0;
}
#include <iostream>
#include <map>
using namespace std;
long long int parejas;
long long int n, aux;
map<int, long long int> arre;
int main()
{
    cin>>n;
    for(int i=1;i<=n;++i){
        cin>>aux;
        arre[aux]++;
    }
    aux=0;
    for(pair<int, long long int> recorre : arre){
        parejas+=((recorre.second*(n-recorre.second))-(aux*recorre.second));
        aux+=recorre.second;
    }
    cout<<parejas;
    return 0;
}
