from collections import Counter

N = int(eval(input()))

dlist = Counter([int(eval(input())) for _ in range(N)])

print((len(list(dlist.items()))))

print((len(set([int(eval(input())) for _ in range(int(eval(input())))]))))

from collections import Counter

N = int(eval(input()))
dlist = Counter([int(eval(input())) for _ in range(N)])
print((len(list(dlist.items()))))

print((len(set([int(eval(input())) for _ in range(int(eval(input())))]))))

-from collections import Counter - -N = int(eval(input())) -dlist = Counter([int(eval(input())) for _ in range(N)]) -print((len(list(dlist.items())))) +print((len(set([int(eval(input())) for _ in range(int(eval(input())))]))))