#include <bits/stdc++.h>
#define MAX 100000000
int eratos[MAX];

void Eratos() {
	eratos[0] = 1;
	for (int i = 1; i * i <= MAX; i++) {
		if (eratos[i - 1] == 0) {
			for (int j = i * 2; j <= MAX; j += i) {
				eratos[j] = 1;
			}
		}
	}
}

int main()
{
	int n, res;
	Eratos();
	cin >> n;
	for (int i = 0, tmp; i < n; i++) {
		cin >> tmp;
		if (eratos[tmp - 1] == 0) res++;
	}
	cout << res << endl;
	return 0;
}