def main():

    N = int(eval(input()))

    A = [eval(input()) for i in range(N)]

    M = int(eval(input()))

    B = [eval(input()) for i in range(M)]

    ans = 0

    from collections import Counter

    S = Counter(A)

    T = Counter(B)

    for k, v in list(S.items()):

        ans = max(ans, v - T[k])

    print(ans)





if __name__ == '__main__':

    main()

def main():

    N = int(eval(input()))

    S = [eval(input()) for i in range(N)]

    M = int(eval(input()))

    T = [eval(input()) for i in range(M)]

    ans = 0

    from collections import Counter

    c = Counter(S)

    cT = Counter(T)

    for k, v in list(c.items()):

        ans = max(ans, v - cT[k])

    print(ans)





if __name__ == '__main__':

    main()

def main():
    N = int(eval(input()))
    A = [eval(input()) for i in range(N)]
    M = int(eval(input()))
    B = [eval(input()) for i in range(M)]
    ans = 0
    from collections import Counter

    S = Counter(A)
    T = Counter(B)
    for k, v in list(S.items()):
        ans = max(ans, v - T[k])
    print(ans)


if __name__ == "__main__":
    main()

def main():
    N = int(eval(input()))
    S = [eval(input()) for i in range(N)]
    M = int(eval(input()))
    T = [eval(input()) for i in range(M)]
    ans = 0
    from collections import Counter

    c = Counter(S)
    cT = Counter(T)
    for k, v in list(c.items()):
        ans = max(ans, v - cT[k])
    print(ans)


if __name__ == "__main__":
    main()

-    A = [eval(input()) for i in range(N)] +    S = [eval(input()) for i in range(N)] -    B = [eval(input()) for i in range(M)] +    T = [eval(input()) for i in range(M)] -    S = Counter(A) -    T = Counter(B) -    for k, v in list(S.items()): -        ans = max(ans, v - T[k]) +    c = Counter(S) +    cT = Counter(T) +    for k, v in list(c.items()): +        ans = max(ans, v - cT[k])