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

template<size_t max_N, size_t prime_size>
class Prime{
    bool sieve[max_N];
    int_fast64_t prime[prime_size];
    size_t counter = 1;
public:
    constexpr Prime() : sieve(), prime() {
        for(int_fast64_t i = 0; i < max_N; ++i)
            sieve[i] = i & 1;
        sieve[0] = sieve[1] = false;
        sieve[2] = true;
        prime[0] = 2;
        for(int_fast64_t i = 3; i < max_N; ++i){
            if(sieve[i]){
                prime[counter] = i;
                ++counter;
                if(counter >= prime_size)break;
            }
            for(int_fast64_t j = i * i; j < max_N; j += i)
                sieve[j] = false;
        }
    }
    constexpr bool operator[](size_t i) const {
        return sieve[i];
    }
};

constexpr auto p = Prime<100000001, 170>();
uint_fast64_t N, a, b;

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