# Counter를 통해 날짜와 일치하는 차량 개수를 셈
from collections import Counter
n,L = input(), input().split()
D = Counter(L)
print(D[n])
# 단순 반복문
n = input()
L = input().split()
number = 0
for e in L:
if n == e:
number +=1
else:
number += 0
print(number)
# list comprehension
d,L = input(), input().split()
ans = [i for i in L if i==d]
print(len(ans))