from collections import Counter

N=int(eval(input()))

S=Counter([eval(input()) for i in range(N)])

M=int(eval(input()))

T=Counter([eval(input()) for i in range(M)])

ans=0

for key in list(S.keys()):

    ans = max(S.get(key)-T.get(key,0),ans)

print(ans)
n=int(eval(input()))

s=[eval(input()) for i in range(n)]

m=int(eval(input()))

t=[eval(input()) for i in range(m)]

li=list(set(s))

print((max(0,max(s.count(li[i])-t.count(li[i]) for i in range(len(li))))))
from collections import Counter

N = int(eval(input()))
S = Counter([eval(input()) for i in range(N)])
M = int(eval(input()))
T = Counter([eval(input()) for i in range(M)])
ans = 0
for key in list(S.keys()):
    ans = max(S.get(key) - T.get(key, 0), ans)
print(ans)

n = int(eval(input()))
s = [eval(input()) for i in range(n)]
m = int(eval(input()))
t = [eval(input()) for i in range(m)]
li = list(set(s))
print((max(0, max(s.count(li[i]) - t.count(li[i]) for i in range(len(li))))))

-from collections import Counter - -N = int(eval(input())) -S = Counter([eval(input()) for i in range(N)]) -M = int(eval(input())) -T = Counter([eval(input()) for i in range(M)]) -ans = 0 -for key in list(S.keys()): -    ans = max(S.get(key) - T.get(key, 0), ans) -print(ans) +n = int(eval(input())) +s = [eval(input()) for i in range(n)] +m = int(eval(input())) +t = [eval(input()) for i in range(m)] +li = list(set(s)) +print((max(0, max(s.count(li[i]) - t.count(li[i]) for i in range(len(li))))))