N = int(input())
S = [input() for i in range(N)]
M = int(input())
T = [input() for i in range(M)]
 
Scores = []
for s in S:
  score = len([s2 for s2 in S if s == s2])
  score -= len([s2 for s2 in T if s == s2])
  Scores.append(score)
print(max(Scores) if max(Scores)>0 else 0)