import collections

N = int(eval(input()))

blue = []

red = []

for i in range(N):

    s = eval(input())

    blue.append(s)

bc = sorted(list(collections.Counter(blue).items()), key = lambda x:x[1],reverse = True)

M = int(eval(input()))

for i in range(M):

    t = eval(input())

    red.append(t)

rc = collections.Counter(red)



count = []

for i in range(len(bc)):

    count.append(bc[i][1])

    if bc[i][0] in rc:

        count[i] -= rc[bc[i][0]]



print((max(0,max(count))))

    

    
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)
import collections

N = int(eval(input()))
blue = []
red = []
for i in range(N):
    s = eval(input())
    blue.append(s)
bc = sorted(list(collections.Counter(blue).items()), key=lambda x: x[1], reverse=True)
M = int(eval(input()))
for i in range(M):
    t = eval(input())
    red.append(t)
rc = collections.Counter(red)
count = []
for i in range(len(bc)):
    count.append(bc[i][1])
    if bc[i][0] in rc:
        count[i] -= rc[bc[i][0]]
print((max(0, max(count))))

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)

-import collections - -blue = [] -red = [] -for i in range(N): -    s = eval(input()) -    blue.append(s) -bc = sorted(list(collections.Counter(blue).items()), key=lambda x: x[1], reverse=True) +s = [eval(input()) for i in range(N)] -for i in range(M): -    t = eval(input()) -    red.append(t) -rc = collections.Counter(red) -count = [] -for i in range(len(bc)): -    count.append(bc[i][1]) -    if bc[i][0] in rc: -        count[i] -= rc[bc[i][0]] -print((max(0, max(count)))) +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)