#include<stdio.h>
#include<math.h>
#define MAX 10000000
int main()
{
	int i, j,n,s,ary[10000],most=0,s[MAX],x;
	
	bool a[MAX];
	
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &ary[i]);
        if(ary[i]>most) most=ary[i];
	}
        for (i = 0; i < most+1; i++) {
		a[i] = i >= 2 ? 1:0;
	}
	x=sqrt(most+1);
	for (i = 2; i < x; i++) {
		if (a[i]) {
			for (j = 0; i*(j + 2) < MAX; j++) {
				a[i*(j + 2)] = 0;
			}
		}
	}

	s = 0;
	
	for (i = 0; i < n; i++) {
		if (a[ary[i]]) s++;
	}
	printf("%d\n",s);
}