from collections import Counter



n = int(eval(input()))

ss = Counter(eval(input()) for _ in range(n))

m = int(eval(input()))

ts = Counter(eval(input()) for _ in range(m))

print((max(max(0, cs - ts[s]) for s, cs in list(ss.items()))))
from collections import Counter

 

n = int(eval(input()))

ss = Counter(eval(input()) for _ in range(n))

m = int(eval(input()))

ts = Counter(eval(input()) for _ in range(m))

answer = max(cs - ts[s] for s, cs in list(ss.items()))

print((answer if answer > 0 else 0))
from collections import Counter

n = int(eval(input()))
ss = Counter(eval(input()) for _ in range(n))
m = int(eval(input()))
ts = Counter(eval(input()) for _ in range(m))
print((max(max(0, cs - ts[s]) for s, cs in list(ss.items()))))

from collections import Counter

n = int(eval(input()))
ss = Counter(eval(input()) for _ in range(n))
m = int(eval(input()))
ts = Counter(eval(input()) for _ in range(m))
answer = max(cs - ts[s] for s, cs in list(ss.items()))
print((answer if answer > 0 else 0))

-print((max(max(0, cs - ts[s]) for s, cs in list(ss.items())))) +answer = max(cs - ts[s] for s, cs in list(ss.items())) +print((answer if answer > 0 else 0))