from collections import Counter



n = int(eval(input()))

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

m = int(eval(input()))

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



db, dr = [Counter(x) for x in (b, r)]

print((max(*[v-dr[k] for k, v in list(db.items())]+[0])))

n = int(eval(input()))

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

m = int(eval(input()))

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

print((max(0, max(s.count(w)-t.count(w) for w in set(s)))))

from collections import Counter

n = int(eval(input()))
b = [eval(input()) for _ in range(n)]
m = int(eval(input()))
r = [eval(input()) for _ in range(m)]
db, dr = [Counter(x) for x in (b, r)]
print((max(*[v - dr[k] for k, v in list(db.items())] + [0])))

n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
m = int(eval(input()))
t = [eval(input()) for _ in range(m)]
print((max(0, max(s.count(w) - t.count(w) for w in set(s)))))

-from collections import Counter - -b = [eval(input()) for _ in range(n)] +s = [eval(input()) for _ in range(n)] -r = [eval(input()) for _ in range(m)] -db, dr = [Counter(x) for x in (b, r)] -print((max(*[v - dr[k] for k, v in list(db.items())] + [0]))) +t = [eval(input()) for _ in range(m)] +print((max(0, max(s.count(w) - t.count(w) for w in set(s)))))