import sys

eval(input())

def f():print((sum(2 in[x,pow(2,x,x)]for x in map(int,sys.stdin))))

f()

import sys

eval(input())

print((sum(2 in[x,pow(2,x,x)]for x in map(int,sys.stdin.readlines()))))

import sys

eval(input())


def f():
    print((sum(2 in [x, pow(2, x, x)] for x in map(int, sys.stdin))))


f()

import sys

eval(input())
print((sum(2 in [x, pow(2, x, x)] for x in map(int, sys.stdin.readlines()))))

- - -def f(): -    print((sum(2 in [x, pow(2, x, x)] for x in map(int, sys.stdin)))) - - -f() +print((sum(2 in [x, pow(2, x, x)] for x in map(int, sys.stdin.readlines()))))