#include <iostream>
#define Max 1<<15
unsigned int p[Max]={2,3,5,7},top=4;
bool IsPri[Max]={0,0,1,1,0,1,0,1};
void get_primer()
{
int n=1<<30,t=4,i,j;
bool f;
for(i=11;i<Max;)
{
f=0;
for(j=0;j<top&&p[j]*p[j]<=i;j++)
if(i%p[j]==0) {f=1;break;}
if(!f) {p[top++]=i;IsPri[i]=1;}
t=t-2?2:4;
i+=t;
}
}
int main()
{
int n,i,j;
get_primer();
while(~scanf("%d",&n))
{
int sum=0,k;
for(i=0;i<n;i++)
{
scanf("%d",&k);
if(k<=p[top-1]&&IsPri[k]) sum++;
else
{
bool f=0;
for(j=0;j<top&&p[j]*p[j]<=k;j++)
if(k%p[j]==0) {f=1;break;}
if(!f) sum++;
}
}
printf("%d\n",sum);
}
return 0;
}