#!/usr/bin/env python3

from itertools import takewhile

from math import sqrt





def is_prime(primes, i):

    if i in primes:

        return True

    for p in takewhile(lambda x: x * x <= i, sorted(primes)):

        if i % p == 0:

            return False

    return True





def sieve_of_eratosthenes(max):

    is_prime = [True] * (max + 1)

    is_prime[0] = False

    is_prime[1] = False

    for i in range(2, int(sqrt(max)) + 1):

        if not is_prime[i]:

            continue

        for j in range(i * i, max + 1, i):

            is_prime[j] = False

    return [x for x in range(max + 1) if is_prime[x]]



primes = set(sieve_of_eratosthenes(10000))



n = int(eval(input()))

c = 0

for _ in range(n):

    i = int(eval(input()))

    if is_prime(primes, i):

        c += 1

print(c)
#!/usr/bin/env python3

from itertools import count, takewhile





def prime():

    prime = []



    def _isPrime(n):

        for d in takewhile(lambda x: x * x <= n, prime):

            if n % d == 0:

                return False

        return True

    for i in count(2):

        if _isPrime(i):

            prime.append(i)

            yield(i)





def is_prime(primes, i):

    for p in takewhile(lambda x: x * x <= i, sorted(primes)):

        if i % p == 0:

            return False

    return True



primes = list(takewhile(lambda x: x < 10000, prime()))



n = int(eval(input()))

c = 0

for _ in range(n):

    i = int(eval(input()))

    if is_prime(primes, i):

        c += 1

print(c)
#!/usr/bin/env python3
from itertools import takewhile
from math import sqrt


def is_prime(primes, i):
    if i in primes:
        return True
    for p in takewhile(lambda x: x * x <= i, sorted(primes)):
        if i % p == 0:
            return False
    return True


def sieve_of_eratosthenes(max):
    is_prime = [True] * (max + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(sqrt(max)) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * i, max + 1, i):
            is_prime[j] = False
    return [x for x in range(max + 1) if is_prime[x]]


primes = set(sieve_of_eratosthenes(10000))
n = int(eval(input()))
c = 0
for _ in range(n):
    i = int(eval(input()))
    if is_prime(primes, i):
        c += 1
print(c)

#!/usr/bin/env python3
from itertools import count, takewhile


def prime():
    prime = []

    def _isPrime(n):
        for d in takewhile(lambda x: x * x <= n, prime):
            if n % d == 0:
                return False
        return True

    for i in count(2):
        if _isPrime(i):
            prime.append(i)
            yield (i)


def is_prime(primes, i):
    for p in takewhile(lambda x: x * x <= i, sorted(primes)):
        if i % p == 0:
            return False
    return True


primes = list(takewhile(lambda x: x < 10000, prime()))
n = int(eval(input()))
c = 0
for _ in range(n):
    i = int(eval(input()))
    if is_prime(primes, i):
        c += 1
print(c)

-from itertools import takewhile -from math import sqrt +from itertools import count, takewhile + + +def prime(): +    prime = [] + +    def _isPrime(n): +        for d in takewhile(lambda x: x * x <= n, prime): +            if n % d == 0: +                return False +        return True + +    for i in count(2): +        if _isPrime(i): +            prime.append(i) +            yield (i) -    if i in primes: -        return True -def sieve_of_eratosthenes(max): -    is_prime = [True] * (max + 1) -    is_prime[0] = False -    is_prime[1] = False -    for i in range(2, int(sqrt(max)) + 1): -        if not is_prime[i]: -            continue -        for j in range(i * i, max + 1, i): -            is_prime[j] = False -    return [x for x in range(max + 1) if is_prime[x]] - - -primes = set(sieve_of_eratosthenes(10000)) +primes = list(takewhile(lambda x: x < 10000, prime()))