from sympy import *
N = int(input())
first_list = [int(input()) for i in range(N)]
second_list = [number for number in first_list if isprime(number) == True]
print(len(second_list))
from sympy import *
N = int(input())
first_list = [int(input()) for i in range(N)]
second_list = [number for number in first_list if isprime(number) == True]
print(len(second_list))