#include<bits/stdc++.h>
using namespace std;
#define ll int
#define maxn 20000002
bool isprime[maxn+1];
bool two_primes[maxn+1];
void sieve(){
isprime[0]=isprime[1]=false;
for(ll i=2;i<=(ll)sqrt(maxn);i++){
if(isprime[i]){
for(ll j=i*i;j<=maxn;j+=i) isprime[j]=false;
}
}
}
void sieve_2(){
two_primes[0]=two_primes[1]=false;
for(ll i=2;i<=(ll)sqrt(maxn);i++){
if(isprime[i]){
two_primes[i]=false;
for(ll j=i*i;j<=maxn;j+=i){
if(!isprime[j/i]) two_primes[j]=false;
}
}
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
memset(isprime,true,sizeof(isprime));
memset(two_primes,true,sizeof(two_primes));
sieve();
sieve_2();
ll n;
cin>>n;
ll res = 0;
for(ll i=0;i<n;i++){
ll x;
cin>>x;
if(two_primes[x] && !isprime[x]){
// cout<<"db: "<<x<<'\n';
res++;
}
}
// cout<<"res: "<<res;
cout<<res;
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBsbCBpbnQgCiNkZWZpbmUgbWF4biAyMDAwMDAwMgpib29sIGlzcHJpbWVbbWF4bisxXTsKYm9vbCB0d29fcHJpbWVzW21heG4rMV07CnZvaWQgc2lldmUoKXsKICAgIGlzcHJpbWVbMF09aXNwcmltZVsxXT1mYWxzZTsKICAgIGZvcihsbCBpPTI7aTw9KGxsKXNxcnQobWF4bik7aSsrKXsKICAgICAgICBpZihpc3ByaW1lW2ldKXsKICAgICAgICAgICAgZm9yKGxsIGo9aSppO2o8PW1heG47ais9aSkgaXNwcmltZVtqXT1mYWxzZTsKICAgICAgICB9CiAgICB9Cn0Kdm9pZCBzaWV2ZV8yKCl7CiAgICB0d29fcHJpbWVzWzBdPXR3b19wcmltZXNbMV09ZmFsc2U7CiAgICBmb3IobGwgaT0yO2k8PShsbClzcXJ0KG1heG4pO2krKyl7CiAgICAgICAgaWYoaXNwcmltZVtpXSl7CiAgICAgICAgICAgIHR3b19wcmltZXNbaV09ZmFsc2U7CiAgICAgICAgICAgIGZvcihsbCBqPWkqaTtqPD1tYXhuO2orPWkpewogICAgICAgICAgICAgICAgaWYoIWlzcHJpbWVbai9pXSkgdHdvX3ByaW1lc1tqXT1mYWxzZTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICAKICAgIH0KfQppbnQgbWFpbigpewogICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbygwKTsKICAgIGNpbi50aWUoMCk7CiAKICAgIG1lbXNldChpc3ByaW1lLHRydWUsc2l6ZW9mKGlzcHJpbWUpKTsKICAgIG1lbXNldCh0d29fcHJpbWVzLHRydWUsc2l6ZW9mKHR3b19wcmltZXMpKTsKICAgIHNpZXZlKCk7CiAgICBzaWV2ZV8yKCk7CiAgICAKICAgIGxsIG47CiAgICBjaW4+Pm47CiAgICBsbCByZXMgPSAwOwogICAgZm9yKGxsIGk9MDtpPG47aSsrKXsKICAgICAgICBsbCB4OwogICAgICAgIGNpbj4+eDsKICAgICAgICBpZih0d29fcHJpbWVzW3hdICYmICFpc3ByaW1lW3hdKXsKICAgICAgICAgICAgLy8gY291dDw8ImRiOiAgIjw8eDw8J1xuJzsKICAgICAgICAgICAgcmVzKys7CiAgICAgICAgfQogICAgfQogICAgLy8gY291dDw8InJlczogIjw8cmVzOwogICAgY291dDw8cmVzOwogICAgcmV0dXJuIDA7Cn0=