#include <bits/stdc++.h>
#define task "TIHON"
#define Yin ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define xD if (fopen(task".INP", "r")){freopen(task".INP", "r", stdin);freopen(task".OUT", "w", stdout);}
#define f  first
#define s second

using namespace std;

int n;
int uoc[1000006];
int a[1000006];
int cnt = 0;
bool check(int k)
{
    long long temp = 1;
    for(int i = 2;i *i <= k;i += 1)
        if(k % i == 0)
            if(i*i != k)
                temp += i + n/i;
            else temp += i;
    return temp > k;
}
int main()
{
    Yin xD
    for(int i = 1;i <= 1000000;i += 1)
        for(int j = i*2;j <= 1000000;j += i)
            uoc[j] += i;
    cin >> n;
    for(int i = 1;i <= n;i += 1 ){
        cin >> a[i];
        if(a[i] <= 1000000){
            if(uoc[a[i]] > a[i])
                cnt += 1;
        }
        else cnt += check(a[i]);
    }
    cout << cnt;
    return 0;
}
