from random import randrange

def eratosthenes(size):
    table = [True] * (size + 1)
    table[0] = table[1] = True
    for i in range(2, int(round(pow(size+1, 0.5)))):
        if not table[i]:
            continue
        for j in range(i + i, size+1, i):
            table[j] = False
    return table

def miller_rabin(n, k=20):
    if n == 2:
        return True
    if n == 1 or n % 2 == 0:
        return False
    d = n - 1
    while d & 1 == 0:
        d >>= 1
    for _ in range(k):
        a = randrange(1, n)
        y = pow(a, d, n)
        t = d
        while (t != n - 1) and (y != 1) and (y != n - 1):
            y = pow(y, 2, n)
            t <<= 1
        if (y != n - 1 ) and ((t & 1) == 0):
            return False
    return True

if __name__ == "__main__":
    N = int(input())
    print(sum(map(miller_rabin, [int(input()) for _ in range(N)]))) from random import randrange def eratosthenes(size):
    table = [True] * (size + 1)
    table[0] = table[1] = True
    for i in range(2, int(round(pow(size+1, 0.5)))):
        if not table[i]:
            continue
        for j in range(i + i, size+1, i):
            table[j] = False
    return table eratosthenes table = [True] * (size + 1) table [True] * (size + 1) [True] True size + 1 size 1 table[0] = table[1] = True table[0] table 0 True = table[1] = True table[1] table 1 True for i in range(2, int(round(pow(size+1, 0.5)))):
        if not table[i]:
            continue
        for j in range(i + i, size+1, i):
            table[j] = False
     i range(2, int(round(pow(size+1, 0.5)))) range 2 int(round(pow(size+1, 0.5))) int round(pow(size+1, 0.5)) round pow(size+1, 0.5) pow size+1 size 1 0.5 if not table[i]:
            continue
         not table[i] table[i] table i continue for j in range(i + i, size+1, i):
            table[j] = False
     j range(i + i, size+1, i) range i + i i i size+1 size 1 i table[j] = False table[j] table j False return table table size size def miller_rabin(n, k=20):
    if n == 2:
        return True
    if n == 1 or n % 2 == 0:
        return False
    d = n - 1
    while d & 1 == 0:
        d >>= 1
    for _ in range(k):
        a = randrange(1, n)
        y = pow(a, d, n)
        t = d
        while (t != n - 1) and (y != 1) and (y != n - 1):
            y = pow(y, 2, n)
            t <<= 1
        if (y != n - 1 ) and ((t & 1) == 0):
            return False
    return True miller_rabin if n == 2:
        return True
     n == 2 n 2 return True True if n == 1 or n % 2 == 0:
        return False
     n == 1 or n % 2 == 0 n == 1 n 1 n % 2 == 0 n % 2 n 2 0 return False False d = n - 1 d n - 1 n 1 while d & 1 == 0:
        d >>= 1
     d & 1 == 0 d & 1 d 1 0 d >>= 1 d 1 for _ in range(k):
        a = randrange(1, n)
        y = pow(a, d, n)
        t = d
        while (t != n - 1) and (y != 1) and (y != n - 1):
            y = pow(y, 2, n)
            t <<= 1
        if (y != n - 1 ) and ((t & 1) == 0):
            return False
     _ range(k) range k a = randrange(1, n) a randrange(1, n) randrange 1 n y = pow(a, d, n) y pow(a, d, n) pow a d n t = d t d while (t != n - 1) and (y != 1) and (y != n - 1):
            y = pow(y, 2, n)
            t <<= 1
         (t != n - 1) and (y != 1) and (y != n - 1) (t != n - 1) and (y != 1) t != n - 1 t n - 1 n 1 y != 1 y 1 y != n - 1 y n - 1 n 1 y = pow(y, 2, n) y pow(y, 2, n) pow y 2 n t <<= 1 t 1 if (y != n - 1 ) and ((t & 1) == 0):
            return False
     (y != n - 1 ) and ((t & 1) == 0) y != n - 1 y n - 1 n 1 (t & 1) == 0 t & 1 t 1 0 return False False return True True n n k=20 k 20 if __name__ == "__main__":
    N = int(input())
    print(sum(map(miller_rabin, [int(input()) for _ in range(N)]))) __name__ == "__main__" __name__ "__main__" N = int(input()) N int(input()) int input() input int(input()) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) int(input()) int input() input print(sum(map(miller_rabin, [int(input()) for _ in range(N)]))) print sum(map(miller_rabin, [int(input()) for _ in range(N)])) sum map(miller_rabin, [int(input()) for _ in range(N)]) map miller_rabin [int(input()) for _ in range(N)] def eratosthenes(size):
    table = [True] * (size + 1)
    table[0] = table[1] = True
    for i in range(2, int(round(pow(size+1, 0.5)))):
        if not table[i]:
            continue
        for j in range(i + i, size+1, i):
            table[j] = False
    return table def eratosthenes(size):
    table = [True] * (size + 1)
    table[0] = table[1] = True
    for i in range(2, int(round(pow(size+1, 0.5)))):
        if not table[i]:
            continue
        for j in range(i + i, size+1, i):
            table[j] = False
    return table eratosthenes N = int(input()) int(input()) N def miller_rabin(n, k=20):
    if n == 2:
        return True
    if n == 1 or n % 2 == 0:
        return False
    d = n - 1
    while d & 1 == 0:
        d >>= 1
    for _ in range(k):
        a = randrange(1, n)
        y = pow(a, d, n)
        t = d
        while (t != n - 1) and (y != 1) and (y != n - 1):
            y = pow(y, 2, n)
            t <<= 1
        if (y != n - 1 ) and ((t & 1) == 0):
            return False
    return True def miller_rabin(n, k=20):
    if n == 2:
        return True
    if n == 1 or n % 2 == 0:
        return False
    d = n - 1
    while d & 1 == 0:
        d >>= 1
    for _ in range(k):
        a = randrange(1, n)
        y = pow(a, d, n)
        t = d
        while (t != n - 1) and (y != 1) and (y != n - 1):
            y = pow(y, 2, n)
            t <<= 1
        if (y != n - 1 ) and ((t & 1) == 0):
            return False
    return True miller_rabin
from random import randrange

def eratosthenes(size):
    table = [True] * (size + 1)
    table[0] = table[1] = True
    for i in range(2, int(round(pow(size+1, 0.5)))):
        if not table[i]:
            continue
        for j in range(i + i, size+1, i):
            table[j] = False
    return table

def miller_rabin(n, k=20):
    if n == 2:
        return True
    if n == 1 or n % 2 == 0:
        return False
    d = n - 1
    while d & 1 == 0:
        d >>= 1
    for _ in range(k):
        a = randrange(1, n)
        y = pow(a, d, n)
        t = d
        while (t != n - 1) and (y != 1) and (y != n - 1):
            y = pow(y, 2, n)
            t <<= 1
        if (y != n - 1 ) and ((t & 1) == 0):
            return False
    return True

if __name__ == "__main__":
    N = int(input())
    print(sum(map(miller_rabin, [int(input()) for _ in range(N)])))