from itertools import groupby

N = int(input())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]

def main():
    for t in T:
        if t in S:
            S.remove(t)
    ans = [len(list(group)) for key, group in groupby(S)]
    print(max([0] + ans))

if __name__ == "__main__":
    main()