N = int(eval(input()))

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

M = int(eval(input()))

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



from collections import Counter

CS = Counter(S).most_common()

CT = Counter(T)



ans = 0

for cs in CS:

    k,v = cs

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



print(ans)

# Python3 (3.4.3)

import sys

input = sys.stdin.readline



# -------------------------------------------------------------

# function

# -------------------------------------------------------------





# -------------------------------------------------------------

# main

# -------------------------------------------------------------

N = int(eval(input()))

S = [input().rstrip() for _ in range(N)]

M = int(eval(input()))

T = [input().rstrip() for _ in range(M)]



from collections import defaultdict

dic = defaultdict(int)



for s in S:

    dic[s] += 1

for t in T:

    dic[t] -= 1



ans = 0

for v in list(dic.values()):

    ans = max(ans, v)



print(ans)
N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
M = int(eval(input()))
T = [eval(input()) for _ in range(M)]
from collections import Counter

CS = Counter(S).most_common()
CT = Counter(T)
ans = 0
for cs in CS:
    k, v = cs
    ans = max(ans, v - CT[k])
print(ans)

# Python3 (3.4.3)
import sys

input = sys.stdin.readline
# -------------------------------------------------------------
# function
# -------------------------------------------------------------
# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N = int(eval(input()))
S = [input().rstrip() for _ in range(N)]
M = int(eval(input()))
T = [input().rstrip() for _ in range(M)]
from collections import defaultdict

dic = defaultdict(int)
for s in S:
    dic[s] += 1
for t in T:
    dic[t] -= 1
ans = 0
for v in list(dic.values()):
    ans = max(ans, v)
print(ans)

+# Python3 (3.4.3) +import sys + +input = sys.stdin.readline +# function +# main -S = [eval(input()) for _ in range(N)] +S = [input().rstrip() for _ in range(N)] -T = [eval(input()) for _ in range(M)] -from collections import Counter +T = [input().rstrip() for _ in range(M)] +from collections import defaultdict -CS = Counter(S).most_common() -CT = Counter(T) +dic = defaultdict(int) +for s in S: +    dic[s] += 1 +for t in T: +    dic[t] -= 1 -for cs in CS: -    k, v = cs -    ans = max(ans, v - CT[k]) +for v in list(dic.values()): +    ans = max(ans, v)