from collections import Counter

n = int(input())
b = [input() for _ in range(n)]
m = int(input())
r = [input() for _ in range(m)]

db, dr = [Counter(x) for x in (b, r)]
print(max(*[v-dr[k] for k, v in db.items()]+[0]))
