#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<ctime>
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1|1
#define INF 0x3f3f3f3f
typedef long long LL;
using namespace std;/* *************************************************
* Miller_Rabin 算法进行素数测试
* 速度快,可以判断一个 < 2^63 的数是不是素数
*
**************************************************/
const int S = ;
LL mult_mod(LL a,LL b,LL c)
{
a %= c;
b %= c;
LL ret = ;
LL tmp = a;
while(b)
{
if(b & )
{
ret += tmp;
if(ret > c)ret -= c;
}
tmp <<= ;
if(tmp > c)tmp -= c;
b >>= ;
}
return ret;
}
LL pow_mod(LL a,LL n,LL mod)
{
LL ret = ;
LL temp = a%mod;
while(n)
{
if(n & )ret = mult_mod(ret,temp,mod);
temp = mult_mod(temp,temp,mod);
n >>= ;
}
return ret;
}
bool check(LL a,LL n,LL x,LL t)
{
LL ret = pow_mod(a,x,n);
LL last = ret;
for(int i = ;i <= t;i++)
{
ret = mult_mod(ret,ret,n);
if(ret == && last != && last != n-)return true;
last = ret;
}
if(ret != )return true;
else return false;
}
bool MiLLer_Rabin(LL n)
{
if( n < )return false;
if( n == )return true;
if( (n&) == )return false;
LL x = n - ;
LL t = ;
while( (x&)== ){x >>= ; t++;}
srand(time(NULL));
for(int i = ;i < S;i++)
{
LL a = rand()%(n-) + ;
if( check(a,n,x,t) )
return false;
}
return true;
}
int main()
{
LL n, m;
while(cin >> n){
LL cnt=;
for(int i = ; i < n; i++){
cin >> m;
if(MiLLer_Rabin(m))
cnt++;
}
cout << cnt << endl;
}
}