import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {
    private static final int SIZE = 10000000;

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        ArrayList<Integer> primeList = new ArrayList<Integer>(SIZE);
        createPrime(primeList);
        int n = Integer.parseInt(br.readLine());
        int count = 0;
        for (int i = 0; i < n; i++) {
            int p = Integer.parseInt(br.readLine());
            if (prime(p, primeList)) {
                count++;
            }
        }
        System.out.println(count);
    }

    static boolean prime(int n, ArrayList<Integer> primeList) {
        if (n <= 1000000) {
            for (int i = 0; primeList.get(i) * primeList.get(i) <= n; i++) {
                // ????±??????°??????????????\????????¨???????´???°??§????????????
                if (0 == n % primeList.get(i)) { //???????????????????´???°??§?????????
                    return false;
                }
            }
            return true;
        } else {
            for (int i = 0; primeList.get(i) * primeList.get(i) <= 1000000; i++) {
                // ????±??????°??????????????\????????¨???????´???°??§????????????
                if (0 == n % primeList.get(i)) { //???????????????????´???°??§?????????
                    return false;
                }
            }
            for (int i = 3; i * i <= n; i += 2) {
                if (n % i == 0) {
                    return false;
                }
            }
            return true;
        }
    }

    public static void createPrime(ArrayList<Integer> primeList) {
        int n = 1000000;
        primeList.add(2);
        primeList.add(3);
        for (int i = 5; i <= n; i += 2) { //????±?????\???°??????
            boolean wflag = false; //???????????????????????????
            for (int j = 1; primeList.get(j) * primeList.get(j) <= i; j++) {
                // ????±??????°??????????????\????????¨???????´???°??§????????????
                if (0 == i % primeList.get(j)) { //???????????????????´???°??§?????????
                    wflag = true;
                    break;
                }
            }
            if (!wflag) { //???????????§????????????????????£??????
                primeList.add(i); //?´???°??¨????????°????????????
            }
        }
    }
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz