n = int(input())
res = 0

for i in range(0, n):
    j = int(input())
    if j == 0:
        res += 1

print(res)


n = int(input())
res = 0

for i in range(0, n):
    j = int(input())
    if j == 0:
        res += 1

print(res)

