#include <set>
#include <bitset>
#include <list>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <string>
#include <vector>
#include <ios>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <complex>
#include <numeric>
#include <functional>
#include <cmath>
#include <ctime>
#include <climits>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cassert>
#define lson rt << 1, l, m
#define rson rt << 1 | 1, m + 1, r
using namespace std;
const int INF = 0x7FFFFFFF;
const double EPS = 1e-10;
const double PI = 2 * acos (0.0);
const int MOD = 7;
const int maxn = 10000 + 66;
const int testnum = 8; //随机算法判定次数,一般8~10就够了
// 计算ret = (a*b)%c a,b,c < 2^63
long long mult_mod (long long a,long long b,long long mod)
{
a %= mod;
b %= mod;
long long ans = 0;
long long temp = a;
while (b)
{
if (b & 1)
{
ans += temp;
if (ans > mod)
ans -= mod;//直接取模慢很多
}
temp <<= 1;
if (temp > mod)
temp -= mod;
b >>= 1;
}
return ans;
}
long long pow_mod (long long a,long long n,long long mod)
{
long long ans = 1;
long long temp = a % mod;
while (n)
{
if (n & 1)
ans = mult_mod (ans, temp, mod);
temp = mult_mod (temp, temp, mod);
n >>= 1;
}
return ans;
}
// 通过 a^(n-1)=1(mod n)来判断n是不是素数
// n-1 = x*2^t 中间使用二次判断
// 是合数返回true, 不一定是合数返回false
bool check (long long a, long long n, long long x, long long t)
{
long long ans = pow_mod (a, x, n);
long long last = ans;
for(int i = 1; i <= t; i++)
{
ans = mult_mod (ans, ans, n);
if(ans == 1 && last != 1 && last != n - 1)
return true;//合数
last = ans;
}
if(ans != 1)
return true;
else
return false;
}
//**************************************************
// Miller_Rabin算法
// 是素数返回true,(可能是伪素数)
// 不是素数返回false
//**************************************************
bool Miller_Rabin (long long n)
{
if (n < 2)
return false;
if (n == 2)
return true;
if ((n&1) == 0)
return false;//偶数
long long x = n - 1;
long long t = 0;
while ((x&1) == 0)
{
x >>= 1; t++;
}
srand (time (NULL));
for (int i = 0; i < testnum; i++)
{
long long a = rand () % (n - 1) + 1;
if (check (a, n, x, t))
return false;
}
return true;
}
int main()
{
// ifstream cin ("aaa.txt");
long long n;
while (cin >> n)
{
long long sum = 0, temp;
for (int i = 0; i < n; i++)
{
cin >> temp;
if (Miller_Rabin (temp))
sum++;
}
cout << sum << endl;
}
return 0;
}