from collections import Counter

N = int(eval(input()))

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

c1 = Counter(s1)

M = int(eval(input()))

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

c2 = Counter(s2)



ans = 0

for k,v in list(c1.items()):

    ans = max(ans, v-c2[k])

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)]

c1 = Counter(S)

c2 = Counter(T)



ans = 0

for k,v in list(c1.items()):

    tmp = v - c2[k]

    ans = max(ans, tmp)

print(ans)
from collections import Counter

N = int(eval(input()))
s1 = [eval(input()) for i in range(N)]
c1 = Counter(s1)
M = int(eval(input()))
s2 = [eval(input()) for i in range(M)]
c2 = Counter(s2)
ans = 0
for k, v in list(c1.items()):
    ans = max(ans, v - c2[k])
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)]
c1 = Counter(S)
c2 = Counter(T)
ans = 0
for k, v in list(c1.items()):
    tmp = v - c2[k]
    ans = max(ans, tmp)
print(ans)

-s1 = [eval(input()) for i in range(N)] -c1 = Counter(s1) +S = [eval(input()) for i in range(N)] -s2 = [eval(input()) for i in range(M)] -c2 = Counter(s2) +T = [eval(input()) for i in range(M)] +c1 = Counter(S) +c2 = Counter(T) -    ans = max(ans, v - c2[k]) +    tmp = v - c2[k] +    ans = max(ans, tmp)