from collections import Counter



n = int(eval(input()))

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

m = int(eval(input()))

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



ans = 0

key = ''

for i in list(s.keys()):

    ans = max((s[i]-t[i]), ans)



print(ans)



n = int(eval(input()))

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

m = int(eval(input()))

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



ans = 0



for i in s:

    a = s.count(i)

    b = t.count(i)

    ans = max(a-b, ans)



print(ans)



from collections import Counter

n = int(eval(input()))
s = Counter([eval(input()) for _ in range(n)])
m = int(eval(input()))
t = Counter([eval(input()) for _ in range(m)])
ans = 0
key = ""
for i in list(s.keys()):
    ans = max((s[i] - t[i]), ans)
print(ans)

n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
m = int(eval(input()))
t = [eval(input()) for _ in range(m)]
ans = 0
for i in s:
    a = s.count(i)
    b = t.count(i)
    ans = max(a - b, ans)
print(ans)

-from collections import Counter - -s = Counter([eval(input()) for _ in range(n)]) +s = [eval(input()) for _ in range(n)] -t = Counter([eval(input()) for _ in range(m)]) +t = [eval(input()) for _ in range(m)] -key = "" -for i in list(s.keys()): -    ans = max((s[i] - t[i]), ans) +for i in s: +    a = s.count(i) +    b = t.count(i) +    ans = max(a - b, ans)