def counting (l,s):
  for i in range(len(l)):
    A.append(l.count(l[i])-s.count(l[i]))
N=int(input())
L=[input() for i in range(N)]
M=int(input())
S=[input() for i in range(M)]
A=[0]
counting(L,S)
print(max(A))