#include<bits/stdc++.h>
using namespace std;

template<size_t max_N>
class LargeSieve{
    uint_fast64_t n = max_N >> 6;
    uint_fast64_t sieve[(max_N >> 6) + 1];
public:
    constexpr LargeSieve() : sieve(){
        // noshi91さんのコードを参考にしました
        // http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=3039786#1
        for(size_t i = 0; i < max_N >> 6; ++i)
            sieve[i] = 12297829382473034410;
        sieve[0] ^= 6;
        for(size_t i = 2; i * i < max_N; ++i)
            if(sieve[i >> 6] >> (i & 0x3F) & 1)
                for(size_t j = i * i; j < max_N; j += i)
                    sieve[j >> 6] &= ~(static_cast<uint_fast64_t>(1) << (j & 0x3F));
    }
    constexpr bool operator[](size_t i) const {
        return sieve[i >> 6] >> (i & 0x3F) & 1;
    }
};

constexpr auto p = LargeSieve<100000001>();
uint_fast64_t a, b;

int main(){
    scanf("%lu", &a);
    for(;cin >> a;)b += p[a];
    cout << b << endl;
    return 0;
}
