n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for i in range(m)]

l = []
for i in range(n):
  S = s.count(s[i])
  T = t.count(s[i])
  l.append(S - T)
  
if max(l) < 0:
  print("0")
else:
  print(max(l))
