Takahashi has N blue cards and M red cards.
A string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i.
Takahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will earn 1 yen (the currency of Japan); each time he finds a red card with that string, he will lose 1 yen.
Here, we only consider the case where the string announced by Takahashi and the string on the card are exactly the same. For example, if he announces atcoder, he will not earn money even if there are blue cards with atcoderr, atcode, btcoder, and so on. (On the other hand, he will not lose money even if there are red cards with such strings, either.)
At most how much can he earn on balance?
Note that the same string may be written on multiple cards.

-----Constraints-----
 - N and M are integers.
 - 1 \leq N, M \leq 100
 - s_1, s_2, ..., s_N, t_1, t_2, ..., t_M are all strings of lengths between 1 and 10 (inclusive) consisting of lowercase English letters.

-----Input-----
Input is given from Standard Input in the following format:
N
s_1
s_2
:
s_N
M
t_1
t_2
:
t_M

-----Output-----
If Takahashi can earn at most X yen on balance, print X.

-----Sample Input-----
3
apple
orange
apple
1
grape

-----Sample Output-----
2

He can earn 2 yen by announcing apple.
[{"code": "def resolve():\n    n = int(input())\n    blue_cards = list()\n    for i in range(n):\n        card = input()\n        blue_cards.append(card)\n    blue_cards = sorted(blue_cards)\n    m = int(input())\n    red_cards = list()\n    for i in range(m):\n        card = input()\n        red_cards.append(card)\n    red_cards = sorted(red_cards)\n    former = \"\"\n    cards_points = []\n    for card in blue_cards:\n        point = 0\n        if former == card:\n            continue\n        else:\n            p = blue_cards.count(card)\n            m = red_cards.count(card)\n            point = p - m\n            cards_points.append(point)\n            former = card\n    cards_points = sorted(cards_points)\n    if cards_points[-1] < 0:\n        print(0)\n    else:\n        print(cards_points[-1])\nresolve()", "passed": true, "time": 0.14, "memory": 14360.0, "status": "done"}, {"code": "n = int(input())\ns = [input() for _ in range(n)]\nm = int(input())\nt = [input() for _ in range(m)]\n\nans = 0\ncnt = 0\nfor i in set(s):\n  cnt = s.count(i) - t.count(i)\n  ans = max(ans, cnt)\nprint(ans)", "passed": true, "time": 0.17, "memory": 14120.0, "status": "done"}, {"code": "n = int(input())\na = []\nfor i in range(n):\n  a.append([input(),0])\nm = int(input())\nb = []\nfor i in range(m):\n  b.append([input(),0])\n\nres = 0\nfor i in range(n):\n  c = 0\n  if a[i][1] == 0:\n    a[i][1] = 1\n    for j in range(i,n):\n      if a[i][0] == a[j][0]:\n        c += 1\n        a[j][1] = 1\n    for j in range(m):\n      if a[i][0] == b[j][0]:\n        c -= 1\n  res = max(res,c)\nprint(res)", "passed": true, "time": 0.18, "memory": 14092.0, "status": "done"}, {"code": "n = int(input())\ns = [input() for s in range(n)]\nm = int(input())\nt = [input() for i in range(m)]\nplus = []\nminus = []\ntotal = []\n\nfor i in set(s):\n    plus.append(s.count(i))\n    minus.append(t.count(i))\n\nfor j in range(len(plus)):\n    total.append(plus[j]-minus[j])\n    \nprint(max(0,max(total)))", "passed": true, "time": 0.14, "memory": 14340.0, "status": "done"}, {"code": "n = int(input())\nlist_s = [input() for i in range(0, n)]\nm = int(input())\nlist_t = [input() for i in range(0, m)]\ndict_blue = {}\ndict_red = {}\nlist_ans = []\nfor i in range(0, n):\n    if list_s[i] in dict_blue: pass\n    else: dict_blue[list_s[i]] = list_s.count(list_s[i])\nfor i in range(0, m):\n    if list_t[i] in dict_red: pass\n    else: dict_red[list_t[i]] = list_t.count(list_t[i])\nfor key, value in dict_blue.items():\n    if key in dict_red.keys():\n        list_ans.append(value - dict_red[key])\n    else:\n        list_ans.append(value)\nif max(list_ans) > 0: print(max(list_ans))\nelse: print(0)", "passed": true, "time": 0.27, "memory": 14324.0, "status": "done"}, {"code": "n = int(input())\nblue = []\nfor i in range(n):\n    blue.append(input())\nm = int(input())\nred = []\nfor i in range(m):\n    red.append(input())\nscores = []\nfor i in range(len(blue)):\n    score = blue.count(blue[i]) - red.count(blue[i])\n    scores.append(score)\n\nif max(scores) < 0:\n    print(0)\nelse:\n    print(max(scores))", "passed": true, "time": 0.24, "memory": 14192.0, "status": "done"}, {"code": "n = int(input())\nsl = list(input() for _ in range(n))\nm = int(input())\ntl = list(input() for _ in range(m))\n\nsl_s = list(set(sl))\ntl_s = list(set(tl))\n\nans = 0\nfor s in sl_s:\n    ans = max(ans, sl.count(s) - tl.count(s))\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14056.0, "status": "done"}, {"code": "#from statistics import median\n#import collections\n#aa = collections.Counter(a) # list to list || .most_common(2)\u3067\u6700\u5927\u306e2\u500b\u3068\u308a\u3060\u305b\u308b\u304a a[0][0]\nfrom math import gcd\nfrom itertools import combinations,permutations,accumulate, product # (string,3) 3\u56de\n#from collections import deque\nfrom collections import deque,defaultdict,Counter\nimport decimal\nimport re\nimport math\nimport bisect\nimport heapq\n#\n#\n#\n# python\u3067\u7121\u7406\u306a\u3068\u304d\u306f\u3001pypy\u3067\u3084\u308b\u3068\u6b63\u89e3\u3059\u308b\u304b\u3082\uff01\uff01\n#\n#\n# my_round_int = lambda x:np.round((x*2 + 1)//2)\n# \u56db\u6368\u4e94\u5165g\n#\n# \u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u7cfb\n# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);\n# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);\n#\n#\nimport sys\nsys.setrecursionlimit(10000000)\nmod = 10**9 + 7\n#mod = 9982443453\n#mod = 998244353\nINF = float('inf')\nfrom sys import stdin\nreadline = stdin.readline\ndef readInts():\n  return list(map(int,readline().split()))\ndef readTuples():\n    return tuple(map(int,readline().split()))\ndef I():\n    return int(readline())\nn = I()\ns = Counter([input() for _ in range(n)])\nm = I()\nt = Counter([input() for _ in range(m)])\nans = 0\nfor k,v in list(s.items()):\n    ans = max(ans, max(0, v-t[k]))\nprint(ans)\n", "passed": true, "time": 0.17, "memory": 14196.0, "status": "done"}, {"code": "n = int(input())\ns = [input() for _ in range(n)]\nm = int(input())\nt = [input() for _ in range(m)]\nans = 0\nl = list(set(s))\nfor i in range(len(l)):\n    ans = max(ans,s.count(l[i])-t.count(l[i]))\nprint(ans)        ", "passed": true, "time": 0.22, "memory": 14100.0, "status": "done"}, {"code": "N = int(input())\ns = []\nfor i in range(N):\n    s.append(input())\ns.append('')\nM = int(input())\nt = []\nfor j in range(M):\n    t.append(input())\n\nans = 0\nfor i in range(N + 1):\n    target = s[i]\n    cnt = 0\n    for j in range(N):\n        if target == s[j]:\n            cnt += 1\n    for k in range(M):\n        if target == t[k]:\n            cnt -= 1\n    ans = max(ans, cnt)\nprint(ans)\n", "passed": true, "time": 0.17, "memory": 14196.0, "status": "done"}, {"code": "from collections import Counter\nN = int(input())\ns = [input() for i in range(N)]\nM = int(input())\nt = [input() for i in range(M)]\n\nS = Counter(s)\nT = Counter(t)\n\nfor key, value in list(S.items()):\n    if key in list(T.keys()):\n        S[key] -= T[key]\n\nif max(S.values()) > 0:\n    print((max(S.values())))\nelse:\n    print((0))\n\n", "passed": true, "time": 0.17, "memory": 14096.0, "status": "done"}, {"code": "n = int(input())\nblues = [input() for _ in range(n)]\nm = int(input())\nreds = [input() for _ in range(m)]\n\nmax_price = 0\n\nfor blue in blues:\n    plus = len(list([x for x in blues if x == blue]))\n    minus = len(list([x for x in reds if x == blue]))\n    price = plus - minus\n    if price > max_price:\n        max_price = price\n\nprint(max_price)\n", "passed": true, "time": 0.27, "memory": 14252.0, "status": "done"}, {"code": "N = int(input())\ndic = {}\nfor i in range(N):\n    word = input()\n    if word in dic:\n        dic[word] +=1\n    else:\n        dic[word] = 1\nM = int(input())\nfor i in range(M):\n    word = input()\n    if word in dic:\n        dic[word] -= 1\n    else:\n        dic[word] = -1\n\nans = 0#-float('inf')\nfor i in dic:\n    ans = max(ans, dic[i])\nprint(ans)", "passed": true, "time": 0.14, "memory": 14272.0, "status": "done"}, {"code": "n = int(input())\ns = [input().split() for _ in range(n)]\nm = int(input())\nt = [input().split() for _ in range(m)]\nans = -100\nfor i in s:\n    ans = max(ans,s.count(i) - t.count(i))\nif ans < 0:\n    ans = 0\nprint(ans)", "passed": true, "time": 0.14, "memory": 14084.0, "status": "done"}, {"code": "n = int(input())\ns = []\nfor i in range(n):\n    s.append(input())\nm = int(input())\nt = []\nfor i in range(m):\n    t.append(input())\n\nwords = set(s + t)\nmax_val = 0\nfor word in words:\n    ans = s.count(word)\n    ans -= t.count(word)\n    if ans > max_val:\n        max_val = ans\nprint(max_val) ", "passed": true, "time": 0.14, "memory": 14128.0, "status": "done"}, {"code": "n = int(input())\ns = [input() for i in range(n)]\nm = int(input())\nt = [input() for i in range(m)]\nc = 0\nfor i in set(s):\n    d = s.count(i)-t.count(i)\n    if d > c:\n        c = d\nprint(c)", "passed": true, "time": 0.14, "memory": 14280.0, "status": "done"}, {"code": "bag = {}\nN = int(input())\nfor _ in range(N):\n    s = input()\n    if s in bag:\n        bag[s] += 1\n    else:\n        bag[s] = 1\nM = int(input())\nfor _ in range(M):\n    s = input()\n    if s in bag:\n        bag[s] -= 1\n\nd_swap = {v: k for k, v in list(bag.items())}\nif max(d_swap) < 0:\n    print((0))\nelse:\n    print((max(d_swap)))\n", "passed": true, "time": 0.14, "memory": 14232.0, "status": "done"}, {"code": "b=[]\nr=[]\nc=[]\nn=int(input())\ncnt=0\nfor i in range(n):\n    s=input()\n    b.append(s)\nm=int(input())\nfor j in range(m):\n    t=input()\n    r.append(t)\nfor i in b:\n    cnt += b.count(i)-r.count(i)\n    c.append(cnt)\n    cnt=0\nprint(max(max(c),0))", "passed": true, "time": 0.17, "memory": 14320.0, "status": "done"}, {"code": "n = int(input())\nblue = list()\nfor i in range(n):\n    blue.append(input())\nm = int(input())\nred = list()\nfor j in range(m):\n    red.append(input())\nans = 0\nfor p in range(n):\n    cnt = 0\n    for q in range(n):\n        if blue[p] == blue[q]:\n            cnt += 1\n    for r in range(m):\n        if blue[p] == red[r]:\n            cnt -= 1\n    ans = max(ans, cnt)\nprint(ans)", "passed": true, "time": 0.26, "memory": 14208.0, "status": "done"}, {"code": "n = int(input())\ns = []\nt = []\nans = 0\nfor i in range(n):\n  s.append(input())\nm = int(input())\nfor i in range(m):\n  t.append(input())\nl = set(s)\nfor i in l:\n  ans = max(ans,s.count(i) - t.count(i))\nprint(ans)\n\n\n", "passed": true, "time": 0.15, "memory": 14236.0, "status": "done"}, {"code": "from collections import defaultdict\nd1 = defaultdict(int)\nd2 = defaultdict(int)\nn = int(input())\nfor i in range(n):\n    d1[input()] += 1\nm = int(input())\nfor i in range(m):\n    d2[input()] += 1\n\nans = 0\nfor k, v in list(d1.items()):\n    ans = max(ans, v - d2[k])\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14244.0, "status": "done"}, {"code": "N = int(input())\ns = [input() for i in range(N)]\nM = int(input())\nt = [input() for i in range(M)]\n\ns_dic = {}\nt_dic = {}\n\nfor i in s:\n  if i in s_dic.keys():\n    s_dic[i] += 1\n  else:\n    s_dic[i] = 1\n    \nfor i in t:\n  if i in t_dic.keys():\n    t_dic[i] += 1\n  else:\n    t_dic[i] = 1\n    \nall_list = []\n\nfor i in s_dic.keys():\n  if i in t_dic.keys():\n    all_list.append(s_dic[i] - t_dic[i])\n  else:\n    all_list.append(s_dic[i])\n    \nfor i in t_dic.keys():\n  if i in s_dic.keys():\n    all_list.append(s_dic[i] - t_dic[i])\n  else:\n    all_list.append(-t_dic[i])\n    \nprint(max(max(all_list), 0))", "passed": true, "time": 0.14, "memory": 14308.0, "status": "done"}, {"code": "N=int(input())\ns=[input() for i in range(N)]\nM=int(input())\nt=[input() for i in range(M)]\n\ndef ans091(N:int, s:list, M:int, t:list):\n    test_count=0\n    own=list(set(s))\n    for i in range(len(own)):\n        if test_count<=s.count(own[i])-t.count(own[i]):\n            test_count=s.count(own[i])-t.count(own[i])\n    if test_count>0:\n        return test_count\n    else:\n        return 0\nprint(ans091(N,s,M,t))", "passed": true, "time": 0.18, "memory": 14280.0, "status": "done"}, {"code": "n = int(input())\nblue_cards = []\nfor i in range(n):\n    blue_cards.append(input())\n\nm = int(input())\nred_cards = []\nfor i in range(m):\n    red_cards.append(input())\n\nscores = []\nfor i in range(len(blue_cards)):\n    score = blue_cards.count(blue_cards[i]) - red_cards.count(blue_cards[i])\n    scores.append(score)\n\nif max(scores) < 0:\n    print((0))\nelse:\n    print((max(scores)))\n", "passed": true, "time": 0.22, "memory": 14096.0, "status": "done"}, {"code": "#B - Two Colors Card Game\nN = int(input())\ns = [input() for _ in range(N)]\nM = int(input())\nt = [input() for _ in range(M)]\ns_set = list(set(s))\n\nmaxim = 0\nfor i in s_set:\n    count = 0\n    for j in s:\n        if i == j:\n            count += 1\n    for k in t:\n        if i == k:\n            count -= 1\n    if maxim<count:\n        maxim = count\nprint(maxim)", "passed": true, "time": 0.14, "memory": 14148.0, "status": "done"}, {"code": "N = int(input())\nS = [input() for _ in range(N)]\nM = int(input())\nT = [input() for _ in range(M)]\n\nfrom collections import Counter\ncounter = Counter(S)\ncounter.subtract(T)\nprint(max(0, max(counter.values())))", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}, {"code": "n = int(input())\ns = []\nfor _ in range(n):\n    s.append(str(input()))\nm = int(input())\nt = []\nfor _ in range(m):\n    t.append(str(input()))\na = []\nfor i in s:\n    if i not in a:\n        a.append(i)\nfor i in t:\n    if i not in a:\n        a.append(i)\nb = []\nfor i in a:\n    x = s.count(i)\n    y = t.count(i)\n    b.append(x - y)\nprint(max(0, max(b)))", "passed": true, "time": 0.17, "memory": 14272.0, "status": "done"}, {"code": "words={\"\":0}\nN=int(input())\nfor i in range(N):\n  word=input()\n  words[word]=words.get(word,0)+1\nM=int(input())\nfor i in range(M):\n  word=input()\n  words[word]=words.get(word,0)-1\nprint(max(words.values()))", "passed": true, "time": 0.14, "memory": 14240.0, "status": "done"}, {"code": "from collections import Counter\nfrom sys import stdin\ndef input():\n    return stdin.readline().strip()\n\nn = int(input())\ns = [input() for _ in range(n)]\nm = int(input())\nt = [input() for _ in range(m)]\n\ns = Counter(s)\nt = Counter(t)\n\nans = 0\nfor key, num in s.items():\n    if key in t:\n        if ans < num - t[key]:\n            ans = num - t[key]\n    else:\n        if ans < num:\n            ans = num\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14108.0, "status": "done"}, {"code": "from collections import Counter\n# ABC091\nN = int(input())\nS = Counter([input() for _ in range(N)])\nM = int(input())\nT = Counter([input() for _ in range(M)])\n\nans = 0\n\nfor word, count in S.items():\n    temp = count - T[word]\n    ans = max(ans, temp)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14060.0, "status": "done"}, {"code": "#!/usr/bin/env python3\n\ndef main():\n    blue = [input() for i in range(int(input()))]\n    red = [input() for i in range(int(input()))]\n    l = list(set(blue))\n    print((max(0, max(blue.count(l[i]) - red.count(l[i]) for i in range(len(l))))))\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14352.0, "status": "done"}, {"code": "n = int(input())\ns = [\"\"]*n\nfor i in range(n):\n    s[i] = input()\nimport collections\ns = collections.Counter(s)\nm = int(input())\nfor j in range(m):\n    t = input()\n    if t in s:\n        s[t] -= 1\nprint(max(0, s.most_common()[0][1]))", "passed": true, "time": 0.14, "memory": 14196.0, "status": "done"}, {"code": "n = int(input())\ns = [input().split() for i in range(n)]\nm = int(input())\nt = [input().split() for i in range(m)]\nans = 0\nfor i in range(n):\n    temp = s.count(s[i]) - t.count(s[i])\n    ans = max(ans,temp)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14088.0, "status": "done"}, {"code": "from collections import defaultdict\n\n\ncnt = defaultdict(int)\ncnt[0] = 0\nN = int(input())\nfor _ in range(N):\n    cnt[input()] += 1\nM = int(input())\nfor _ in range(M):\n    cnt[input()] -= 1\nprint((max(v for v in list(cnt.values()))))\n", "passed": true, "time": 0.14, "memory": 14196.0, "status": "done"}, {"code": "N = int(input())\nNs = []\nfor i in range(N):\n  Ns.append(input())\n  \nM = int(input())\nMs = []\nfor i in range(M):\n  Ms.append(input())\n  \nWs = list(set(Ns + Ms))\n\nAs = []\nfor i in Ws:\n  ans = 0\n  for j in Ns:\n    if i == j:\n      ans += 1\n  for j in Ms:\n    if i == j:\n      ans -= 1\n  As.append(ans)\n  \nprint((max(max(As), 0)))\n", "passed": true, "time": 0.14, "memory": 14236.0, "status": "done"}, {"code": "n = int(input())\ns = [input() for _ in range(n)]\nm = int(input())\nt = [input() for _ in range(m)]\nli = []\nfor i in range(n):\n    li += [s.count(s[i])-t.count(s[i])]\nprint(max(max(li),0))", "passed": true, "time": 0.16, "memory": 14244.0, "status": "done"}, {"code": "N=int(input())\ns=dict()\nfor _ in range(N):\n    S=input()\n    if S not in s:\n        s[S]=0\n    s[S]+=1\nM=int(input())\nfor _ in range(M):\n    t=input()\n    if t in s:\n        s[t]-=1\nprint((max(max(0,x) for x in list(s.values()))))\n", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "N = int(input())\nblue = [input() for _ in range(N)] \nM = int(input())\nred = [input() for _ in range(M)] \n\nset_blue = set(blue)  \nscores = []\nfor s in set_blue:\n  score = blue.count(s) - red.count(s)\n  scores.append(score)\n  \nms = max(scores)\nif ms>=0:\n  print(ms)\nelse:\n  print(0)", "passed": true, "time": 0.14, "memory": 14092.0, "status": "done"}, {"code": "#!/usr/bin/env python3\nfrom collections import Counter\n\nn = int(input())\ns = [str(input()) for i in range(n)]\nm = int(input())\nt = [str(input()) for i in range(m)]\n\ns = Counter(s)\n\nt = Counter(t)\n\nans = 0\nfor i in list(s.keys()):\n    if i in t:\n        ans_tmp = s[i] - t[i]\n    else:\n        ans_tmp = s[i]\n    ans = max(ans, ans_tmp)\nprint(ans)\n", "passed": true, "time": 0.21, "memory": 14412.0, "status": "done"}, {"code": "# -*- coding: utf-8 -*-\n\nred_cards = []\nblue_cards = []\nN = int(input())\nfor i in range(N):\n    blue_cards.append(input())\nM = int(input())\nfor i in range(M):\n    red_cards.append(input())\n\n\nall_words = set(blue_cards + red_cards)\n\nans = 0\nfor i,w in enumerate(all_words):\n    cnt_b = cnt_r = 0\n    for b in blue_cards:\n        if b == w:\n            cnt_b += 1\n    for r in red_cards:\n        if r == w:\n            cnt_r+= 1\n\n    diff = cnt_b - cnt_r\n    if diff > ans:\n        ans = diff\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14276.0, "status": "done"}, {"code": "N = int(input())\ns = []\nfor i in range(N):\n   s.append(input())\nM = int(input())\nt = []\nfor i in range(M):\n   t.append(input())\n\ndef point(x):\n   result = 0\n   result += s.count(x)\n   result -= t.count(x)\n   return result\n\nans = 0\n\nfor word in set(s):\n   if ans < point(word):\n      ans = point(word)\n\nprint(ans)", "passed": true, "time": 0.3, "memory": 14088.0, "status": "done"}, {"code": "N = int(input())\nn = 0\nblue = []\nwhile n<N:\n  blue.append(input())\n  n += 1\n\nM = int(input())\nm = 0\nred = []\nwhile m<M:\n  red.append(input())\n  m += 1\n  \nset_blue = set(blue)  \nscores = []\nfor s in set_blue:\n  score = blue.count(s) - red.count(s)\n  scores.append(score)\n  \nms = max(scores)\nif ms>=0:\n  print(ms)\nelse:\n  print(0)", "passed": true, "time": 0.14, "memory": 14216.0, "status": "done"}, {"code": "n = int(input())\nblue = [input() for i in range(n)]\nm = int(input())\nred = [input() for i in range(m)]\n\nans = 0\nfor i in range(n):\n    tmp = blue.count(blue[i]) - red.count(blue[i])\n    ans = max(ans, tmp)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14264.0, "status": "done"}, {"code": "n=int(input())\ns=[input() for i in range(n)]\nm=int(input())\nt=[input() for i in range(m)]\n\nans=[]\nfor i in s:\n    cnt=0\n    for j in range(n):\n        if i==s[j]:\n            cnt+=1\n    for k in range(m):\n        if i==t[k]:\n            cnt-=1\n    ans.append(cnt)\n\nif max(ans)<0:\n    print('0')\nelse:\n    print(max(ans))", "passed": true, "time": 0.15, "memory": 14176.0, "status": "done"}, {"code": "n = int(input())\ns = [input() for _ in range(n)]\nm = int(input())\nt = [input() for _ in range(m)]\ns_set = list(set(s))\nwin = max(s.count(s_set[i]) - t.count(s_set[i]) for i in range(len(s_set)))\nprint(max(0,win))", "passed": true, "time": 0.14, "memory": 14172.0, "status": "done"}, {"code": "n = int(input())\nsl = list(input() for _ in range(n))\nm = int(input())\ntl = list(input() for _ in range(m))\n\ncnt = 0\nfor s in sl:\n    cnt = max(cnt, sl.count(s) - tl.count(s))\n\nprint(cnt)\n\n", "passed": true, "time": 0.14, "memory": 14076.0, "status": "done"}, {"code": "from collections import Counter\nN = int(input())\nblue = [input() for _ in range(N)]\nM = int(input())\nred = [input() for _ in range(M)]\nCb = Counter(blue)\nCr = Counter(red)\nans = 0\nfor b in Cb.most_common():\n    x = b[0]\n    y = b[1]\n    if Cr.get(x):\n        ans = max(ans, y - Cr[x])\n    else:\n        ans = max(ans, y)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14372.0, "status": "done"}, {"code": "n = int(input())\nstr_dict = dict()\nfor i in range(n):\n    s = input()\n    if s not in str_dict:\n        str_dict[s] = 1\n    else:\n        str_dict[s] += 1\n\nm = int(input())\nfor i in range(m):\n    t = input()\n    if t not in str_dict:\n        str_dict[t] = -1\n    else:\n        str_dict[t] -= 1\n\nres = max(0, sorted(list(str_dict.values()))[-1])\nprint(res)\n", "passed": true, "time": 0.15, "memory": 14100.0, "status": "done"}, {"code": "n = int(input())\na = {}\nfor i in range(n):\n    s = str(input())\n    if s in a.keys():\n        a[s] = a[s] + 1\n    else:\n        a[s] = 1\n        \nm = int(input())\nfor i in range(m):\n    t = str(input())\n    if t in a.keys():\n        a[t] = a[t] - 1\n    else:\n        a[t] = -1\nif max(a.values()) >= 0:\n    print(max(a.values()))\nelif max(a.values()) < 0:\n    print(0)", "passed": true, "time": 0.14, "memory": 14068.0, "status": "done"}, {"code": "import collections\n\nN = int(input())\nS = [input() for i in range(N)]\ncS = collections.Counter(S)\nlS = list(cS.items())\nM = int(input())\nT = [input() for i in range(M)]\ncT = collections.Counter(T)\nlist1 = []\nans = 0\n\nfor i in range(len(lS)):\n    \n    if lS[i][0] in cT:\n        x = lS[i][1] - cT[lS[i][0]]\n        \n    else:\n        x = lS[i][1]\n        \n    if x > 0:\n        list1.append(x)\n    \nif list1 == []:\n  print(0)\nelse:\n  print(max(list1))", "passed": true, "time": 0.14, "memory": 14356.0, "status": "done"}, {"code": "import sys, collections\nlines = [s.rstrip(\"\\n\") for s in sys.stdin.readlines()]\nn, = [int(num) for num in lines.pop(0).split(\" \")]\nblue_list = lines[:n]\nlines = lines[n:]\nm, = [int(num) for num in lines.pop(0).split(\" \")]\nred_list = lines\nblue = collections.Counter(blue_list)\nred = collections.Counter(red_list)\nc = blue - red\nlis = list(c.values())\nif len(lis):\n    ans = max(lis)\nelse:\n    ans = 0\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14124.0, "status": "done"}, {"code": "N = int(input())\ns = {}\nfor i in range(N):\n    x = input()\n    if x in s:\n        s[x] += 1\n    else:\n        s[x] = 1\nM = int(input())\nt = {}\nfor i in range(M):\n    x = input()\n    if x in t:\n        t[x] += 1\n    else:\n        t[x] = 1\n\nb = list(s.keys())\nr = list(t.keys())\nsubs = []\n\nfor i in range(len(b)):\n    if b[i] in r:\n        subs.append(s[b[i]]-t[b[i]])\n    else:\n        subs.append(s[b[i]])\nprint((max(0,max(subs))))\n", "passed": true, "time": 0.14, "memory": 14200.0, "status": "done"}, {"code": "n=int(input())\ns=[input() for i in range(n)]\nm=int(input())\nt=[input() for i in range(m)]\n\nprint((max(0,max(s.count(i)-t.count(i) for i in set(s)))))\n    \n\n\n\n", "passed": true, "time": 0.14, "memory": 14216.0, "status": "done"}, {"code": "blue = []\nred = []\nans = 0\nn = int(input())\nfor i in range(n):\n  blue.append(input())\nm = int(input())\nfor j in range(m):\n  red.append(input())\nword = set(blue)\nfor k in word:\n  c = blue.count(k) - red.count(k)\n  ans = max(ans,c)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14340.0, "status": "done"}, {"code": "from collections import Counter\nn = int(input())\ns = Counter([input() for _ in range(n)])\nm = int(input())\nt = Counter([input() for _ in range(m)])\n\nfor x,y in s.items():\n    s[x] = s[x]-t[x]\nprint(max(max(list(s.values())), 0))", "passed": true, "time": 0.14, "memory": 14264.0, "status": "done"}, {"code": "from collections import defaultdict\nd = defaultdict(int)\nfor _ in range(int(input())):\n    d[input()] += 1\nfor _ in range(int(input())):\n    d[input()] -= 1\nprint(max(0, max(d.values())))", "passed": true, "time": 0.17, "memory": 14304.0, "status": "done"}, {"code": "from collections import Counter\n\nn = int(input())\ns = [None] * n\nfor i in range(n):\n    s[i] = input().rstrip()\n\nm = int(input())\nt = [None] * m\nfor i in range(m):\n    t[i] = input().rstrip()\n\nctr = Counter(s) - Counter(t)\nif ctr:\n    print(ctr.most_common(1)[0][1])\nelse:\n    print(0)", "passed": true, "time": 0.14, "memory": 14300.0, "status": "done"}, {"code": "n = int(input())\ns = [input() for _ in range(n)]\nm = int(input())\nt = [input() for _ in range(m)]\na = 0\nfor x in set(s):\n  a = max(s.count(x) - t.count(x), a)\nprint(a)", "passed": true, "time": 0.14, "memory": 14256.0, "status": "done"}, {"code": "N=int(input())\ns=[input() for i in range(N)]\nM=int(input())\nt=[input() for i in range(M)]\na_list=list(set(s))\ntest_count=0\nfor i in range(len(a_list)):\n    x=a_list[i]\n    if test_count<=s.count(x)-t.count(x):\n        test_count=s.count(x)-t.count(x)\nprint(test_count)", "passed": true, "time": 0.15, "memory": 14352.0, "status": "done"}, {"code": "N = int(input())\nn_list = []\nfor i in range(N):\n  n_list.append(input())\nM = int(input())\nm_list = []\nfor i in range(M):\n  m_list.append(input())\nadd_dic = {}\nfor n in n_list:\n  add = add_dic.get(n, 0)\n  add_dic[n] = add + 1\ndiff_dic = {}\nfor m in m_list:\n  diff = diff_dic.get(m, 0)\n  diff_dic[m] = diff + 1\n\nmax_ = 0\nfor key, add in add_dic.items():\n  total = add - diff_dic.get(key, 0)\n  if total > max_:\n    max_ = total\n\nprint(max_)", "passed": true, "time": 0.23, "memory": 14152.0, "status": "done"}, {"code": "n = int(input())\ns = list(input() for i in range(n))\nm = int(input())\nt = list(input() for i in range(m))\nr = list(set(s+t))\nans = 0\nfor i in r:\n    a = s.count(i)\n    b = t.count(i)\n    ans = max(ans,a-b)\nprint(ans)", "passed": true, "time": 0.24, "memory": 14164.0, "status": "done"}, {"code": "from collections import Counter\nimport math\nimport statistics\nimport itertools\na=int(input())\n# b=input()\n# c=[]\n# for i in a:\n#     c.append(int(i))\n# A,B,C= map(int,input().split())\n# f = list(map(int,input().split()))\ng = [input() for _ in range(a)]\n# h = []\n# for i in range(a):\n#     h.append(list(map(int,input().split())))\n# a = [[0] for _ in range(H)]#nizigen\n\nb = int(input())\ng2 = [input() for _ in range(b)]\n\ng.sort()\ng2.sort()\n\ncount=1\nans={}\nans2={}\n\nfor i in range(len(g)-1):\n    if g[i+1]==g[i]:\n        count+=1\n    else:\n        ans[g[i]]=count\n        count=1\n\nans[g[-1]]=count\ncount=1\nfor i in range(len(g2)-1):\n    if g2[i+1]==g2[i]:\n        count+=1\n    else:\n        if g2[i] in list(ans.keys()):\n            ans[g2[i]]-=count\n            count=1\n        else:\n            ans[g2[i]]=-count\n\nif g2[-1] in list(ans.keys()):\n    ans[g2[-1]]-=count\n    count=1\nelse:\n    ans[g2[-1]]=-count\n\nif max(ans.values())>0:\n    print((max(ans.values())))\nelse:\n    print((0))\n", "passed": true, "time": 0.25, "memory": 14224.0, "status": "done"}, {"code": "n=int(input())\nS=[input() for i in range(n)]\nm=int(input())\nT=[input() for i in range(m)]\nans=0\nfor s in set(S):\n  ans = max(ans,S.count(s)-T.count(s))\nprint(ans)", "passed": true, "time": 0.21, "memory": 14280.0, "status": "done"}, {"code": "n=int(input())\ns=[input() for _ in range(n)]\nm=int(input())\nt=[input() for _ in range(m)]\n\nans=0\nfor i in set(s):\n    ans=max(s.count(i)-t.count(i),ans)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14112.0, "status": "done"}, {"code": "N = int(input())\ns = [input() for i in range(N)]\nM = int(input())\nt = [input() for i in range(M)]\n\nst_dict = {}\n\nfor i in range(N):\n    if s[i] not in st_dict.keys():\n        st_dict[s[i]] = 1\n    else:\n        st_dict[s[i]] += 1\nfor i in range(M):\n    if t[i] not in st_dict.keys():\n        st_dict[t[i]] = -1\n    else:\n        st_dict[t[i]] -= 1\n\nif max(st_dict.values()) < 0:\n    print(0)\nelse:\n    print(max(st_dict.values()))", "passed": true, "time": 0.19, "memory": 14328.0, "status": "done"}, {"code": "n = int(input())\ns_l = [ str(input()) for _ in range(n)  ]\n\nm = int(input())\nt_l = [ str(input()) for _ in range(m)  ]\nd = {}\nfor s in s_l:\n    if s not in d:\n        d[s] = 1\n    else:\n        d[s] += 1\nfor t in t_l:\n    if t not in d:\n        d[t] = -1\n    else:\n        d[t] -= 1\nans = 0\nfor k, v in d.items():\n    ans = max(v, ans)\nprint(ans)", "passed": true, "time": 0.23, "memory": 14312.0, "status": "done"}, {"code": "N = int(input())\nss = [input() for i in range(N)]\nM = int(input())\nts = [input() for i in range(M)]\n\nssset = set(ss)\ncnt = 0\nfor x in ssset:\n\tcnt = max(cnt, ss.count(x) - ts.count(x))\nprint(cnt)\n", "passed": true, "time": 0.23, "memory": 14344.0, "status": "done"}, {"code": "N = int(input())\nS = [input() for _ in range(N)]\nM = int(input())\nT = [input() for _ in range(M)]\nGet = {}\nfor s in S:\n    if s in Get:\n        Get[s] += 1\n    else:\n        Get[s] = 1\nfor t in T:\n    if t in Get:\n        Get[t] += -1\n    else:\n        Get[t] = -1\nans = max(Get.values())\nprint(ans if ans > 0 else 0)", "passed": true, "time": 0.22, "memory": 14312.0, "status": "done"}, {"code": "from collections import Counter\nN = int(input())\nS = [''.join(sorted(input())) for _ in range(N)]\nM = int(input())\nT = [''.join(sorted(input())) for _ in range(M)]\n\ns = Counter(S)\nt = Counter(T)\n\nans = 0\nfor k, v in list(s.items()):\n    tmp = v\n    tmp -= t[k]\n    ans = max(ans, tmp)\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14328.0, "status": "done"}, {"code": "n=int(input())\ns=[]\nt=[]\nfor i in range(n):\n  s.append(input())\nm=int(input())\nfor i in range(m):\n  t.append(input())\n\nm=0\nfor i in range(n):\n  x=s.count(s[i])-t.count(s[i])\n  m=max(m,x)\n\nprint(m)", "passed": true, "time": 0.14, "memory": 14112.0, "status": "done"}, {"code": "import collections\n\nN = int(input())\nS = [input() for i in range(N)]\nM = int(input())\nT = [input() for i in range(M)]\n\nmaxi = 0\n\nfor i in range(len(S)):\n    if S.count(S[i]) - T.count(S[i]) > maxi:\n        maxi = S.count(S[i]) - T.count(S[i])\n\nprint(maxi)", "passed": true, "time": 0.14, "memory": 14184.0, "status": "done"}, {"code": "N = int(input())\nS = []\nfor i in range(N):\n    s = input()\n    S.append(s)\n\nM = int(input())\nT = []\nfor i in range(M):\n    t = input()\n    T.append(t)\n\nans = -1\nx = 0\nfor i in S:\n    x = S.count(i) - T.count(i)\n    ans = max(ans, x)\n\nif ans < 0:\n    ans = 0\n\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14156.0, "status": "done"}, {"code": "Blue=[]\nRed=[]\n\nn=int(input())\nfor i in range(n):\n    s=input()\n    Blue.append(s)\n    \nm=int(input())\nfor i in range(m):\n    t=input()\n    Red.append(t)\n\nans=0\nfor a in Blue:\n    plus = Blue.count(a)\n    minus = Red.count(a)\n    point = plus - minus\n    ans = max(ans, point)\nprint(ans)", "passed": true, "time": 0.15, "memory": 14340.0, "status": "done"}, {"code": "n=int(input())\nans=0\ncount=0\ns={}\nt={}\nfor i in range(n):\n  a=input()\n  if a not in s:\n    s[a]=1\n  else:\n    s[a]+=1\nm=int(input())\nfor i in range(m):\n  a=input()\n  if a not in t:\n    t[a]=1\n  else:\n    t[a]+=1\n    \nS=list(s.keys())\nT=list(t.keys())\nfor i in range(len(S)):\n  if S[i] in T:\n    count=s[S[i]]-t[S[i]]\n  else: count=s[S[i]]\n  ans=max(ans,count)\n  \nprint(ans)", "passed": true, "time": 0.14, "memory": 14124.0, "status": "done"}, {"code": "from collections import Counter\n\nn = int(input())\ns = [input() for _ in range(n)]\nm = int(input())\nt = [input() for _ in range(m)]\n\nc = Counter(s).most_common()\nd = Counter(t)\n\np = -1000\n\nfor k, v in c:\n    p = max(p, v - d[k])\n\nprint(max(p, 0))", "passed": true, "time": 0.14, "memory": 14332.0, "status": "done"}, {"code": "N = int(input())\nblue = {}\nfor _ in range(N):\n  s = input()\n  if s in blue.keys():\n    blue[s] += 1\n  else:\n    blue[s] = 1\n\nM = int(input())\nred = {}\nfor _ in range(M):\n  t = input()\n  if t in red.keys():\n    red[t] += 1\n  else:\n    red[t] = 1\n    \ncnt = 0\nfor i in blue.keys():\n  if i in red.keys():\n    cnt = max(cnt, blue[i] - red[i])\n  else:\n    cnt = max(cnt, blue[i])\n    \nprint(cnt)", "passed": true, "time": 0.14, "memory": 14260.0, "status": "done"}, {"code": "N = int(input())\ns = []\nfor i in range(N):\n    s.append(input())\n\nM = int(input())\nt = []\nfor i in range(M):\n    t.append(input())\n\nmoney_list = []\nfor i in range(N):\n    money = s.count(s[i]) - t.count(s[i])\n    money_list.append(money)\n\nans = max(money_list)\nif ans < 0:\n    print(\"0\")\nelse:\n    print(ans)", "passed": true, "time": 0.15, "memory": 14092.0, "status": "done"}, {"code": "n = int(input())\ns=[]\nfor i in range(n):\n    s.append(input())\nfrom collections import Counter\ncs = Counter(s)\nm = int(input())\nfor i in range(m):\n    t = input()\n    if cs[t]:\n        cs[t] -= 1\nprint(cs.most_common(1)[0][1], flush=True)\n\n", "passed": true, "time": 0.14, "memory": 14328.0, "status": "done"}, {"code": "#!/usr/bin/env python3\n\n\ndef main():\n    N = int(input())\n    s = [input() for _ in range(N)]\n    M = int(input())\n    t = [input() for _ in range(M)]\n    y = 0\n    for ss in set(s):\n        yy = s.count(ss) - t.count(ss)\n        if y < yy:\n            y = yy\n    print(y)\n\n\nmain()\n", "passed": true, "time": 0.14, "memory": 14060.0, "status": "done"}, {"code": "from typing import List\n\n\ndef answer(n: int, s: List[str], m: int, t: List[str]) -> int:\n    result = 0\n    for i in s:\n        result = max(result, s.count(i) - t.count(i))\n\n    return result\n\n\ndef main():\n    n = int(input())\n    s = [input() for _ in range(n)]\n    m = int(input())\n    t = [input() for _ in range(m)]\n    print((answer(n, s, m, t)))\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.15, "memory": 15084.0, "status": "done"}, {"code": "n = int(input())\ns = [input() for _ in range(n)]\nm = int(input())\nt = [input() for _ in range(m)]\nans = 0\nsc = list(set(s.copy()))\nfrom collections import Counter\nsn = Counter(s)\ntn = Counter(t)\nfor i in range(len(sc)):\n  ans = max(sn[sc[i]]-tn[sc[i]],ans)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14144.0, "status": "done"}, {"code": "n = int(input())\ns = [input() for _ in range(n)]\nm = int(input())\nt = [input() for _ in range(m)]\n\nans = 0\nfor i in s:\n    ans = max(ans,s.count(i)-t.count(i))\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14120.0, "status": "done"}, {"code": "n = [input() for _ in range(int(input()))]\nm = [input() for _ in range(int(input()))]\n\nl = list(set(n))\n\nprint(max(0,max(n.count(l[i]) - m.count(l[i]) for i in range(len(l)))))", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "#-*-coding:utf-8-*-\nimport sys\ninput=sys.stdin.readline\n\ndef main():\n    n = int(input())\n    word_dict={}\n    for i in range(n):\n        s = input().rstrip()\n        if s not in word_dict:\n            word_dict[s]=1\n        else:\n            word_dict[s]+=1\n    m = int(input())\n    for j in range(m):\n        t= input().rstrip()\n        if t in word_dict:\n            word_dict[t]-=1\n        else:\n            word_dict[t]=-1\n\n    if max(word_dict.values()) < 0:\n        print(0)\n    else:\n        print(max(word_dict.values()))\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14112.0, "status": "done"}, {"code": "from collections import Counter\n\n\ndef main():\n    n = int(input())\n    blue = Counter(input() for _ in range(n))\n    m = int(input())\n    red = Counter(input() for _ in range(m))\n    ans = 0\n\n    for name, amount in blue.items():\n        if name in red.keys():\n            temp = amount - red[name]\n        else:\n            temp = amount\n        ans = max(ans, temp)\n    print(ans)\n\n\nmain()", "passed": true, "time": 0.14, "memory": 14020.0, "status": "done"}, {"code": "N = int(input())\nS = list(input() for x in range(N))\nM = int(input())\nT = list(input() for y in range(M))\n\ncount = []\n\nfor n in range(N):\n    count.append(S.count(S[n]) - T.count(S[n]))\n\nmax_count = max(count)\nif max_count < 0:\n    print(0)\nelse:\n    print(max_count)", "passed": true, "time": 0.14, "memory": 14116.0, "status": "done"}, {"code": "s, t = [], []\nfor i in range(int(input())):\n\ts.append(input())\nfor i in range(int(input())):\n\tt.append(input())\n\nprofit = 0\nfor i in s:\n\ttemp = s.count(i) - t.count(i)\n\tif profit < temp:\n\t\tprofit = temp\n\nprint(profit)\n", "passed": true, "time": 0.14, "memory": 14188.0, "status": "done"}, {"code": "from collections import defaultdict\nn = int(input())\ns = defaultdict(int)\nt = defaultdict(int)\n\nfor i in range(n):\n    x = input()\n    s[x] += 1\n\nm = int(input())\nfor i in range(m):\n    x = input()\n    t[x] += 1\n\nans = 0\nfor x, v in list(s.items()):\n    now = v - t[x]\n    ans = max(ans, now)\n\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14172.0, "status": "done"}, {"code": "s=[input() for _ in range(int(input()))]\nt=[input() for _ in range(int(input()))]\n \nres=0\nfor i in set(s):\n    res=max(s.count(i)-t.count(i),res)\nprint(res)", "passed": true, "time": 0.16, "memory": 14316.0, "status": "done"}, {"code": "n = int(input())\na = [input() for i in range(n)]\nm = int(input())\nb = [input() for i in range(m)]\ns = a + b\nt = []\nfor i in s:\n  t.append(a.count(i) - b.count(i))\n  \nprint((0 if max(t) <= 0 else max(t)))\n", "passed": true, "time": 0.14, "memory": 14112.0, "status": "done"}, {"code": "N = int(input())\nBlue = [input() for _ in range(N)]\nM = int(input())\nRed = [input() for _ in range(M)]\nWord = Blue + Red\nWord = list(set(Word))\nans = 0\nfor i in range(len(Word)):\n    cnt = 0\n    cnt += Blue.count(Word[i])\n    cnt -= Red.count(Word[i])\n    ans = max(ans,cnt)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14260.0, "status": "done"}, {"code": "N = int(input())\nS = [input() for i in range(N)]\nM = int(input())\nT = [input() for i in range(M)]\n\nanswer = 0\nfor i in S:\n    answer = max(answer, S.count(i) - T.count(i))\nprint(answer)", "passed": true, "time": 0.14, "memory": 14120.0, "status": "done"}, {"code": "from collections import defaultdict\n\ncnt = defaultdict(int)\ncnt[\"a\" * 11] = 0\nfor _ in range(int(input())):\n    cnt[input()] += 1\nfor _ in range(int(input())):\n    cnt[input()] -= 1\nans = max(cnt.values())\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14356.0, "status": "done"}, {"code": "n=int(input())\nS=[]\nT=[]\ndata=set()\nfor i in range(n):\n  s=input()\n  S.append(s)\n  data.add(s)\nm=int(input())\nfor i in range(m):\n  t=input()\n  T.append(t)\n  data.add(t)\nans=0\nfor i in data:\n  ans=max(ans,S.count(i)-T.count(i))\nprint(ans)", "passed": true, "time": 0.14, "memory": 14240.0, "status": "done"}, {"code": "from collections import defaultdict\n\nBlue, Red = defaultdict(int), defaultdict(int)\n\nN = int(input())\nfor _ in range(N):\n  Blue[input()] += 1\n\nM = int(input())\nfor _ in range(M):\n  Red[input()] += 1\n\nans = 0\nfor word, cnt in list(Blue.items()):\n  temp = cnt - Red[word]\n  ans = max(ans, temp)\n\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}, {"code": "n = int(input())\ns = [input() for i in range(n)]\nm = int(input())\nt = [input() for i in range(m)]\n\nk = set(s)\ntot = 0\nfor i in k:\n  tot = max(s.count(i) - t.count(i),tot)\n  \nprint(tot)\n", "passed": true, "time": 0.14, "memory": 14304.0, "status": "done"}]