from collections import defaultdict



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 s in set(S+T):

  ans = max(ans, S.count(s) - T.count(s))



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 s in set(S+T):

  ans = max(ans, S.count(s) - T.count(s))

print(ans)
from collections import defaultdict

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 s in set(S + T):
    ans = max(ans, S.count(s) - T.count(s))
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 s in set(S + T):
    ans = max(ans, S.count(s) - T.count(s))
print(ans)

-from collections import defaultdict -