//
// ALDS1_1 - C Prime Numbers
// A prime number is a natural number which has exactly two distinct natural number divisors: 
// 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
//
// Write a program which reads a list of N integers and prints the number of prime numbers in the list.
//
#include <iostream>
using namespace std;

void read(int& size, int **ppArray);
void checkPrimeNumbers(size_t size, const int* pArray, int& count);
void write(const int count);

int main()
{
    int size = 0, ret = 0;
    int* pArray = NULL;

    read(size, &pArray);
    checkPrimeNumbers(size, pArray, ret);
    write(ret);

    delete pArray;
}

void read(int& size, int **ppArray)
{
    if (NULL == ppArray || NULL != *ppArray)
        return;

    cin >> size;
    if (10000 < size)
        return;

    *ppArray = new int[size];
    for (int i = 0; i < size; i++) {
        cin >> *(*ppArray + i);
    }
}

void checkPrimeNumbers(size_t size, const int* pArray, int& count)
{
    if (NULL == pArray)
        return;

    for (int i = 0; i < size; i++) {
        bool flag = true;
        int value = *(pArray + i);
        if (2 > value)
            continue;
        if (2 == value) {
            count++;
            continue;
        }
        if (0 == value % 2)
            continue;
        for (int j = 3; j <= (int)sqrt(value); j += 2) {
            if (0 == value % j) {
                flag = false;
                break;
            }
        }
        if (true == flag)
            count++;
    }
}

void write(const int count)
{
    cout << count << endl;
}