def get_info(diff):

    length = int(eval(input()))

    strings = {}

    for _ in range(length):

        tmp = eval(input())

        if tmp in strings:

            strings[tmp] += diff

        else:

            strings[tmp] = diff

    return length, strings





def main():

    blue_card, blue_card_str = get_info(1)

    red_card, red_card_str = get_info(-1)

    answer = 0

    available_keys = (list(blue_card_str.keys()) & list(red_card_str.keys())) | list(blue_card_str.keys())

    for key in available_keys:

        if key in red_card_str:

            diff = blue_card_str[key] + red_card_str[key]

        else:

            diff = blue_card_str[key]

        answer = max(answer, diff)

    print(answer)





if __name__ == '__main__':

    main()
def main():

    n = int(eval(input()))

    card = {}

    for _ in range(n):

        s = eval(input())

        if s in card:

            card[s] += 1

        else:

            card[s] = 1

    m = int(eval(input()))

    for _ in range(m):

        t = eval(input())

        if t in card:

            card[t] -= 1

        else:

            card[t] = -1

    card = sorted(list(card.items()), key=lambda x: x[1], reverse=True)

    print((max(card[0][1], 0)))





if __name__ == '__main__':

    main()



def get_info(diff):
    length = int(eval(input()))
    strings = {}
    for _ in range(length):
        tmp = eval(input())
        if tmp in strings:
            strings[tmp] += diff
        else:
            strings[tmp] = diff
    return length, strings


def main():
    blue_card, blue_card_str = get_info(1)
    red_card, red_card_str = get_info(-1)
    answer = 0
    available_keys = (list(blue_card_str.keys()) & list(red_card_str.keys())) | list(
        blue_card_str.keys()
    )
    for key in available_keys:
        if key in red_card_str:
            diff = blue_card_str[key] + red_card_str[key]
        else:
            diff = blue_card_str[key]
        answer = max(answer, diff)
    print(answer)


if __name__ == "__main__":
    main()

def main():
    n = int(eval(input()))
    card = {}
    for _ in range(n):
        s = eval(input())
        if s in card:
            card[s] += 1
        else:
            card[s] = 1
    m = int(eval(input()))
    for _ in range(m):
        t = eval(input())
        if t in card:
            card[t] -= 1
        else:
            card[t] = -1
    card = sorted(list(card.items()), key=lambda x: x[1], reverse=True)
    print((max(card[0][1], 0)))


if __name__ == "__main__":
    main()

-def get_info(diff): -    length = int(eval(input())) -    strings = {} -    for _ in range(length): -        tmp = eval(input()) -        if tmp in strings: -            strings[tmp] += diff +def main(): +    n = int(eval(input())) +    card = {} +    for _ in range(n): +        s = eval(input()) +        if s in card: +            card[s] += 1 -            strings[tmp] = diff -    return length, strings - - -def main(): -    blue_card, blue_card_str = get_info(1) -    red_card, red_card_str = get_info(-1) -    answer = 0 -    available_keys = (list(blue_card_str.keys()) & list(red_card_str.keys())) | list( -        blue_card_str.keys() -    ) -    for key in available_keys: -        if key in red_card_str: -            diff = blue_card_str[key] + red_card_str[key] +            card[s] = 1 +    m = int(eval(input())) +    for _ in range(m): +        t = eval(input()) +        if t in card: +            card[t] -= 1 -            diff = blue_card_str[key] -        answer = max(answer, diff) -    print(answer) +            card[t] = -1 +    card = sorted(list(card.items()), key=lambda x: x[1], reverse=True) +    print((max(card[0][1], 0)))