from collections import Counter



N = int(eval(input()))

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

M = int(eval(input()))

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

a = Counter(s)

a = a.most_common()





ans = 0

for i in a:

  if i[0] not in t:

    ans = max(i[1],ans)



  elif i[0] in t:

    ans = max(i[1] - t.count(i[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)]



ans = 0

for i in s:

  ans = max(ans, s.count(i) - t.count(i))



print(ans)
from collections import Counter

N = int(eval(input()))
s = [eval(input()) for i in range(N)]
M = int(eval(input()))
t = [eval(input()) for i in range(M)]
a = Counter(s)
a = a.most_common()
ans = 0
for i in a:
    if i[0] not in t:
        ans = max(i[1], ans)
    elif i[0] in t:
        ans = max(i[1] - t.count(i[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)]
ans = 0
for i in s:
    ans = max(ans, s.count(i) - t.count(i))
print(ans)

-from collections import Counter - -a = Counter(s) -a = a.most_common() -for i in a: -    if i[0] not in t: -        ans = max(i[1], ans) -    elif i[0] in t: -        ans = max(i[1] - t.count(i[0]), ans) +for i in s: +    ans = max(ans, s.count(i) - t.count(i))