def miller_rabin(n):
    """ primality Test
        if n < 3,825,123,056,546,413,051, it is enough to test 
        a = 2, 3, 5, 7, 11, 13, 17, 19, and 23.
        Complexity: O(log^3 n)
    """
    if n == 2: return True
    if n <= 1 or not n&1: return False

    primes = [2, 3, 5, 7, 11, 13, 17, 19, 23]

    d = n - 1
    s = 0
    while not d&1:
        d >>= 1
        s += 1

    for prime in primes:
        if prime >= n: break
        x = pow(prime, d, n)
        if x == 1: break
        for r in range(s):
            if x == n - 1: break
            if r + 1 == s: return False
            x = x * x % n
    return True

N = int(input())
print(sum(1 for _ in range(N) if miller_rabin(int(input())))) def miller_rabin(n):
    """ primality Test
        if n < 3,825,123,056,546,413,051, it is enough to test 
        a = 2, 3, 5, 7, 11, 13, 17, 19, and 23.
        Complexity: O(log^3 n)
    """
    if n == 2: return True
    if n <= 1 or not n&1: return False

    primes = [2, 3, 5, 7, 11, 13, 17, 19, 23]

    d = n - 1
    s = 0
    while not d&1:
        d >>= 1
        s += 1

    for prime in primes:
        if prime >= n: break
        x = pow(prime, d, n)
        if x == 1: break
        for r in range(s):
            if x == n - 1: break
            if r + 1 == s: return False
            x = x * x % n
    return True miller_rabin """ primality Test
        if n < 3,825,123,056,546,413,051, it is enough to test 
        a = 2, 3, 5, 7, 11, 13, 17, 19, and 23.
        Complexity: O(log^3 n)
    """ if n == 2: return True
     n == 2 n 2 if n <= 1 or not n&1: return False

     n <= 1 or not n&1 n <= 1 n 1 not n&1 n&1 n 1 primes = [2, 3, 5, 7, 11, 13, 17, 19, 23] primes [2, 3, 5, 7, 11, 13, 17, 19, 23] 2 3 5 7 11 13 17 19 23 d = n - 1 d n - 1 n 1 s = 0 s 0 while not d&1:
        d >>= 1
        s += 1

     not d&1 d&1 d 1 d >>= 1 d 1 s += 1 s 1 for prime in primes:
        if prime >= n: break
        x = pow(prime, d, n)
        if x == 1: break
        for r in range(s):
            if x == n - 1: break
            if r + 1 == s: return False
            x = x * x % n
     prime primes if prime >= n: break
         prime >= n prime n x = pow(prime, d, n) x pow(prime, d, n) pow prime d n if x == 1: break
         x == 1 x 1 for r in range(s):
            if x == n - 1: break
            if r + 1 == s: return False
            x = x * x % n
     r range(s) range s if x == n - 1: break
             x == n - 1 x n - 1 n 1 if r + 1 == s: return False
             r + 1 == s r + 1 r 1 s x = x * x % n x x * x % n x * x x x n return True True n n N = int(input()) N int(input()) int input() input print(sum(1 for _ in range(N) if miller_rabin(int(input())))) print sum(1 for _ in range(N) if miller_rabin(int(input()))) sum 1 def miller_rabin(n):
    """ primality Test
        if n < 3,825,123,056,546,413,051, it is enough to test 
        a = 2, 3, 5, 7, 11, 13, 17, 19, and 23.
        Complexity: O(log^3 n)
    """
    if n == 2: return True
    if n <= 1 or not n&1: return False

    primes = [2, 3, 5, 7, 11, 13, 17, 19, 23]

    d = n - 1
    s = 0
    while not d&1:
        d >>= 1
        s += 1

    for prime in primes:
        if prime >= n: break
        x = pow(prime, d, n)
        if x == 1: break
        for r in range(s):
            if x == n - 1: break
            if r + 1 == s: return False
            x = x * x % n
    return True def miller_rabin(n):
    """ primality Test
        if n < 3,825,123,056,546,413,051, it is enough to test 
        a = 2, 3, 5, 7, 11, 13, 17, 19, and 23.
        Complexity: O(log^3 n)
    """
    if n == 2: return True
    if n <= 1 or not n&1: return False

    primes = [2, 3, 5, 7, 11, 13, 17, 19, 23]

    d = n - 1
    s = 0
    while not d&1:
        d >>= 1
        s += 1

    for prime in primes:
        if prime >= n: break
        x = pow(prime, d, n)
        if x == 1: break
        for r in range(s):
            if x == n - 1: break
            if r + 1 == s: return False
            x = x * x % n
    return True miller_rabin N = int(input()) int(input()) N
def miller_rabin(n):
    """ primality Test
        if n < 3,825,123,056,546,413,051, it is enough to test 
        a = 2, 3, 5, 7, 11, 13, 17, 19, and 23.
        Complexity: O(log^3 n)
    """
    if n == 2: return True
    if n <= 1 or not n&1: return False

    primes = [2, 3, 5, 7, 11, 13, 17, 19, 23]

    d = n - 1
    s = 0
    while not d&1:
        d >>= 1
        s += 1

    for prime in primes:
        if prime >= n: break
        x = pow(prime, d, n)
        if x == 1: break
        for r in range(s):
            if x == n - 1: break
            if r + 1 == s: return False
            x = x * x % n
    return True

N = int(input())
print(sum(1 for _ in range(N) if miller_rabin(int(input()))))