import sys

eval(input())

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

import sys

eval(input())

print((len([1 for x in map(int,sys.stdin)if 2 in[x,pow(2,x,x)]])))

import sys

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

import sys

eval(input())
print((len([1 for x in map(int, sys.stdin) if 2 in [x, pow(2, x, x)]])))

-print((sum(1 for x in map(int, sys.stdin) if 2 in [x, pow(2, x, x)]))) +print((len([1 for x in map(int, sys.stdin) if 2 in [x, pow(2, x, x)]])))