Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.

The valid sizes of T-shirts are either "M" or from $0$ to $3$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are not.

There are $n$ winners to the cup for both the previous year and the current year. Ksenia has a list with the T-shirt sizes printed for the last year cup and is yet to send the new list to the printing office. 

Organizers want to distribute the prizes as soon as possible, so now Ksenia is required not to write the whole list from the scratch but just make some changes to the list of the previous year. In one second she can choose arbitrary position in any word and replace its character with some uppercase Latin letter. Ksenia can't remove or add letters in any of the words.

What is the minimal number of seconds Ksenia is required to spend to change the last year list to the current one?

The lists are unordered. That means, two lists are considered equal if and only if the number of occurrences of any string is the same in both lists.


-----Input-----

The first line contains one integer $n$ ($1 \le n \le 100$) — the number of T-shirts.

The $i$-th of the next $n$ lines contains $a_i$ — the size of the $i$-th T-shirt of the list for the previous year.

The $i$-th of the next $n$ lines contains $b_i$ — the size of the $i$-th T-shirt of the list for the current year.

It is guaranteed that all the sizes in the input are valid. It is also guaranteed that Ksenia can produce list $b$ from the list $a$.


-----Output-----

Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.


-----Examples-----
Input
3
XS
XS
M
XL
S
XS

Output
2

Input
2
XXXL
XXL
XXL
XXXS

Output
1

Input
2
M
XS
XS
M

Output
0



-----Note-----

In the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".

In the second example Ksenia should replace "L" in "XXXL" with "S".

In the third example lists are equal.

Difficulty: EASY
Tags: Implementation

Greedy algorithms
Skill types: Greedy algorithms
Expected Time Complexity: O(N^2)

Starter code:

Solutions:
n = int(input())
a = [input() for _ in range(n)]
k = 0
for _ in range(n):
	try:
		a.remove(input())
	except:
		k += 1
print(k)


n = int(input())
a = {}
b = {}
for _ in range(n):
	s = input()
	if s in a:
		a[s] += 1
	else:
		a[s] = 1
for _ in range(n):
	s = input()
	if s in b:
		b[s] += 1
	else:
		b[s] = 1
ans = n
for s in b:
	ans -= min(b[s], a.get(s, 0))
print(ans)


n = int(input())
d1 = {'S': [0, 0, 0, 0], 'M': [0, 0, 0, 0], 'L': [0, 0, 0, 0]}
d2 = {'S': [0, 0, 0, 0], 'M': [0, 0, 0, 0], 'L': [0, 0, 0, 0]}
for i in range(n):
	s = input()
	d1[s[-1]][len(s) - 1] += 1
for i in range(n):
	s = input()
	d2[s[-1]][len(s) - 1] += 1
print(sum((sum((abs(d1[i][j] - d2[i][j]) for j in range(4))) for i in d1)) // 2)


n = int(input())
y = []
for i in range(n):
	a = input()
	y.append(a)
y1 = []
for j in range(n):
	b = input()
	y1.append(b)
y = sorted(y)
y1 = sorted(y1)
j = 0
while j < n:
	k = 0
	while k < n:
		if y[j] == y1[k]:
			y[j] = '0'
			y1[k] = '-1'
			break
		k += 1
	j += 1
y = sorted(y)
y1 = sorted(y1)
count = 0
j = n - 1
while j >= 0 and y[j] != '0' and (y1[j] != '-1'):
	i = 0
	while i < len(y[j]):
		if y[j][i] != y1[j][i]:
			count += 1
		i += 1
	j -= 1
print(count)


n = int(input())
d = []
for i in range(n):
	d.append(input())
e = []
for i in range(n):
	e.append(input())
f = e.copy()
for i in range(0, len(f)):
	if f[i] in d and f[i] in e:
		d.remove(f[i])
		e.remove(f[i])
print(len(d))


import sys

def enter_tshirts(tshirts, n):
	for i in range(n):
		tshirt = input()
		if tshirt in tshirts:
			tshirts[tshirt] += 1
		else:
			tshirts[tshirt] = 1
n = int(input())
old_tshirts = dict()
new_tshirts = dict()
enter_tshirts(old_tshirts, n)
enter_tshirts(new_tshirts, n)
answer = 0
for tshirt in old_tshirts:
	if tshirt in new_tshirts:
		dif = old_tshirts[tshirt] - new_tshirts[tshirt]
		answer += dif if dif >= 0 else 0
	else:
		answer += old_tshirts[tshirt]
print(answer)


n = int(input())
s = [input() for i in range(n)]
t = [input() for i in range(n)]
res = 0
for ln in range(1, 5):
	sv = list(filter(lambda x: len(x) == ln, s))
	tv = list(filter(lambda x: len(x) == ln, t))
	ss = {x: len(list(filter(lambda p: p == x, sv))) for x in set(sv)}
	ts = {x: len(list(filter(lambda p: p == x, tv))) for x in set(tv)}
	for x in set(sv):
		if x not in ts.keys():
			res += ss[x]
		elif ss[x] > ts[x]:
			res += ss[x] - ts[x]
print(res)


n = int(input())
a = []
for i in range(n):
	a.append(input())
b = []
for i in range(n):
	b.append(input())
c = n
for i in a:
	if i in b:
		c -= 1
		b.remove(i)
print(c)


n = int(input())
a = [[], [], [], []]
b = [[], [], [], []]
for i in range(n):
	s = input()
	a[len(s) - 1].append(s)
for i in range(n):
	s = input()
	b[len(s) - 1].append(s)
cnt = 0
for i in range(4):
	for item in b[i]:
		if item in a[i]:
			a[i].remove(item)
	cnt += len(a[i])
print(cnt)


n = input()
n = int(n)
dircPre = {}
dircAft = {}
for x in range(n):
	stri = input()
	if stri in dircPre:
		dircPre[stri] += 1
	else:
		dircPre.update({stri: 1})
for x in range(n):
	stri = input()
	if stri in dircAft:
		dircAft[stri] += 1
	else:
		dircAft.update({stri: 1})
ans = 0
for x in dircAft:
	if x in dircPre:
		if dircPre.get(x) > dircAft.get(x):
			pass
		else:
			ans += dircAft.get(x) - dircPre.get(x)
	else:
		ans += dircAft.get(x)
print(ans)


n = int(input())
a = []
b = []

def mut(s):
	if len(s) == 1:
		return ['M', 'L', 'S']
	return [s[0:-1] + 'S', s[0:-1] + 'L']
from collections import defaultdict
d = defaultdict(int)
res = 0
for i in range(n):
	t = str(input())
	d[t] += 1
for i in range(n):
	t = str(input())
	if d[t] > 0:
		d[t] -= 1
	else:
		b.append(t)
for t in b:
	for p in mut(str(t)):
		if d[p] > 0:
			res += 1
			d[p] -= 1
			break
print(res)


size_dic = {'XXXS': 0, 'XXS': 0, 'XS': 0, 'S': 0, 'M': 0, 'L': 0, 'XL': 0, 'XXL': 0, 'XXXL': 0}
count = int(input())
result = 0
for i in range(0, count):
	size = input()
	size_dic[size] += 1
for i in range(0, count):
	size = input()
	if size_dic[size] > 0:
		size_dic[size] -= 1
for size in size_dic:
	result += size_dic[size]
print(result)


def main():
	n = int(input())
	arr = []
	for i in range(n):
		arr.append(input())
	for i in range(n):
		x = input()
		if x in arr:
			arr.remove(x)
	print(len(arr))
main()


n = int(input())
(a, b) = ([], [])
for i in range(n):
	a.append(input())
for i in range(n):
	b.append(input())
for i in a:
	try:
		b.pop(b.index(i))
	except Exception as e:
		pass
print(len(b))


n = int(input())
a = []
for i in range(n):
	t = input()
	a.append(t)
for i in range(n):
	t = input()
	if t in a:
		a.remove(t)
print(len(a))


r = int(input())
a = [*(input() for _ in range(r))]
ans = 0
for _ in range(r):
	try:
		a.remove(input())
	except:
		ans += 1
print(ans)


n = int(input())
l1 = [input() for i in range(n)]
l2 = [input() for i in range(n)]
count = 0
for item in l1:
	if item in l2:
		l2.remove(item)
		count += 1
print(n - count)


n = int(input())
a = []
b = []
for i in range(n):
	a.append(input())
for i in range(n):
	el = input()
	if el in a:
		a.remove(el)
	else:
		b.append(el)
print(len(a))


import math
n = int(input())
a = {'L': 0, 'M': 0, 'S': 0, 'XL': 0, 'XS': 0, 'XXL': 0, 'XXS': 0, 'XXXL': 0, 'XXXS': 0}
b = {'L': 0, 'M': 0, 'S': 0, 'XL': 0, 'XS': 0, 'XXL': 0, 'XXS': 0, 'XXXL': 0, 'XXXS': 0}
for i in range(n):
	s = input()
	a[s] += 1
for i in range(n):
	s = input()
	b[s] += 1
ans = 0
a = list(a.values())
b = list(b.values())
for i in range(len(a)):
	if a[i] < b[i]:
		ans += b[i] - a[i]
print(ans)


c = {}
d = {}
a = int(input())
for i in range(a):
	b = input()
	if c.get(b) != None:
		c[b] += 1
	else:
		c[b] = 1
for i in range(a):
	b = input()
	if d.get(b) != None:
		d[b] += 1
	else:
		d[b] = 1
res = 0
for i in c:
	if d.get(i) != None:
		k = min(d[i], c[i])
		d[i] -= k
		c[i] -= k
for j in d:
	res += d[j]
print(res)


l1 = [0] * 9
l2 = [0] * 9
j = 0
n = int(input())
for i in range(n):
	s = input()
	if s == 'L':
		l1[0] += 1
	elif s == 'M':
		l1[1] += 1
	elif s == 'S':
		l1[2] += 1
	elif s == 'XL':
		l1[3] += 1
	elif s == 'XS':
		l1[4] += 1
	elif s == 'XXL':
		l1[5] += 1
	elif s == 'XXS':
		l1[6] += 1
	elif s == 'XXXL':
		l1[7] += 1
	else:
		l1[8] += 1
for i in range(n):
	s = input()
	if s == 'L':
		l2[0] += 1
	elif s == 'M':
		l2[1] += 1
	elif s == 'S':
		l2[2] += 1
	elif s == 'XL':
		l2[3] += 1
	elif s == 'XS':
		l2[4] += 1
	elif s == 'XXL':
		l2[5] += 1
	elif s == 'XXS':
		l2[6] += 1
	elif s == 'XXXL':
		l2[7] += 1
	else:
		l2[8] += 1
for i in range(9):
	j += abs(l1[i] - l2[i])
print(j // 2)


x = int(input())
sizes = []
for i in range(x):
	y = input()
	sizes.append(y)
for j in range(x):
	x = input()
	if x in sizes:
		sizes.remove(x)
print(len(sizes))


from __future__ import print_function
import sys
import math
import os.path
import random
from copy import deepcopy
from functools import reduce
from collections import Counter, ChainMap, defaultdict
from itertools import cycle, chain
from queue import Queue, PriorityQueue
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, nlargest, nsmallest
import bisect
from statistics import mean, mode, median, median_low, median_high
sys.setrecursionlimit(10 ** 9)

def log(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)

def ni():
	return map(int, input().split())

def nio(offset):
	return map(lambda x: int(x) + offset, input().split())

def nia():
	return list(map(int, input().split()))

def toString(aList, sep=' '):
	return sep.join((str(x) for x in aList))

def toMapInvertIndex(aList):
	return {k: v for (v, k) in enumerate(aList)}

def sortId(arr):
	return sorted(range(arr), key=lambda k: arr[k])
(n,) = ni()
a = Counter((input() for _ in range(n)))
b = Counter((input() for _ in range(n)))
print(sum((b - a).values()))


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
n = int(input())
a = []
b = []
for i in range(n):
	a.append(str(input()))
for i in range(n):
	s = str(input())
	if s in a:
		del a[a.index(s)]
	else:
		b.append(s)
a.sort(key=len)
b.sort(key=len)
print(len(a))
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


from collections import defaultdict
n = int(input())
prev = defaultdict(lambda : 0, {})
now = []
for i in range(n):
	ele = input()
	prev[ele] += 1
for i in range(n):
	ele = input()
	if prev[ele] > 0:
		prev[ele] -= 1
	elif prev[ele] == 0:
		now.append(ele)
l = len(now)
print(l)


from collections import Counter
N = int(input())
Previous = Counter((input() for i in range(N)))
This = Counter((input() for i in range(N)))
Counter = 0
for i in This:
	if Previous.get(i) != None:
		Min = min(Previous[i], This[i])
		Previous[i] -= Min
		This[i] -= Min
for Key in Previous:
	while Previous[Key] != 0:
		(MinKey, Count, Diff) = (0, 0, 10 ** 9)
		for Key2 in This:
			if len(Key) == len(Key2) and This[Key2] != 0:
				ThisDiff = sum((1 for i in range(len(Key2)) if Key2[i] != Key[i]))
				if ThisDiff < Diff:
					Count = min(Previous[Key], This[Key2])
					MinKey = Key2
					Diff = ThisDiff
		Previous[Key] -= Count
		This[MinKey] -= Count
		Counter += Diff * Count
print(Counter)


n = int(input())
a = []
b = []
for i in range(n):
	a.append(input())
for i in range(n):
	b.append(input())
seconds = n
for i in range(n):
	if a[i] in b:
		index = b.index(a[i])
		del b[index]
		seconds -= 1
print(seconds)


n = int(input())
previous = []
next = []
for i in range(n):
	previous.append(input())
for i in range(n):
	next.append(input())
sizes = ['M', 'S', 'L', 'XS', 'XXS', 'XXXS', 'XL', 'XXL', 'XXXL']
count = 0
for size in sizes:
	c1 = previous.count(size)
	c2 = next.count(size)
	if c1 < c2:
		count += c2 - c1
print(count)


def mi():
	return map(int, input().split())
n = int(input())
old = [0] * n
new = [0] * n
for i in range(n):
	old[i] = input()
for i in range(n):
	new[i] = input()
old.sort()
new.sort()
cnt = 0
i = 0
while i < len(old):
	if old[i] in new:
		del new[new.index(old[i])]
		del old[i]
	else:
		i += 1
for i in range(len(old)):
	old[i] = sorted(list(old[i]))
	new[i] = sorted(list(new[i]))
	for j in range(len(old[i])):
		if old[i][j] != new[i][j]:
			cnt += 1
print(cnt)


n = int(input())
a = b = []
k = 0
for _ in range(n):
	a.append(input())
for i in range(n):
	t = input()
	if t in a:
		a.remove(t)
print(len(a))


from collections import *
n = int(input())
I = lambda : Counter((input() for _ in [0] * n))
(a, b) = (I(), I())
print(sum((max(0, v - b[k]) for (k, v) in a.items())))


l = ['M', 'L', 'S', 'XL', 'XS', 'XXL', 'XXS', 'XXXL', 'XXXS']
t = int(input())
l2 = [0 for i in range(9)]
l3 = [0 for i in range(9)]
for i in range(t):
	l2[l.index(input())] += 1
for i in range(t):
	l3[l.index(input())] += 1
p = [abs(l2[i] - l3[i]) for i in range(9)]
print(sum(p) // 2)


n = int(input())
l1 = {u: [] for u in range(1, 5)}
for i in range(n):
	s = input()
	l1[len(s)].append(s)
arr = []
for j in range(n):
	arr.append(input())
arr.sort(key=lambda x: len(x))
count = 0
for j in arr:
	if j in l1[len(j)]:
		l1[len(j)].remove(j)
	else:
		count += 1
print(count)


n = int(input())
a = [[]] * n
b = [[]] * n
for i in range(n):
	a[i] = input()
for i in range(n):
	b[i] = input()
used = [0] * (2 * n)
for i in range(n):
	for j in range(n):
		if used[i] == 0 and used[j + n] == 0 and (a[i] == b[j]):
			used[i] = 1
			used[j + n] = 1
t = 0
for i in range(n):
	if used[i] == 0:
		s = len(a[i])
		for j in range(n):
			if used[j + n] == 0 and s == len(b[j]):
				c = list(a[i])
				v = list(b[j])
				for k in range(s):
					if c[k] != v[k]:
						c[k] = v[k]
						t += 1
				a[i] = c
				b[j] = v
				used[i] = 1
				used[j + n] = 1
				break
print(t)


n = int(input())
a = [input() for _ in range(n)]
b = [input() for _ in range(n)]
t = 0
import collections
da = collections.defaultdict(int)
db = collections.defaultdict(int)
for (ai, bi) in zip(a, b):
	db[bi] += 1
	da[ai] += 1
print(sum((abs(db[s] - da[s]) for s in set(a + b))) // 2)


n = int(input())
old = []
new = []
for i in range(n):
	old.append(input())
for i in range(n):
	x = input()
	if x not in old:
		new.append(x)
	else:
		old.remove(x)
print(len(new))


arr = 'M S L XL XS XXL XXS XXXL XXXS'
arr.split(' ')
n = int(input())
a = []
b = []
for i in range(n):
	s = input()
	a.append(s)
for i in range(n):
	s = input()
	b.append(s)
lol = []
for i in b:
	if i in a:
		a[a.index(i)] = '1'
	else:
		lol.append(i)
print(len(lol))


n = int(input())
a = [*(input() for _ in [0] * n)]
for _ in [0] * n:
	try:
		a.remove(input())
	except:
		pass
print(len(a))


n = int(input())
l1 = []
for i in range(n):
	l1.append(input())
	l1[i] = l1[i].upper()
l2 = []
for i in range(n):
	l2.append(input())
	l2[i] = l2[i].upper()
l1.sort()
l2.sort()
i = 0
x = n
y = n
while i < x:
	j = 0
	while j < y:
		count = 0
		if l1[i] == l2[j]:
			l1.remove(l1[i])
			l2.remove(l2[j])
			x = x - 1
			y = y - 1
			count = count + 1
			break
		else:
			j = j + 1
	if count != 1:
		i = i + 1
print(len(l1))


n = int(input())
k = ['L', 'M', 'S', 'XS', 'XL', 'XXS', 'XXL', 'XXXS', 'XXXL']
d = {'L': 0, 'M': 0, 'S': 0, 'XS': 0, 'XL': 0, 'XXS': 0, 'XXL': 0, 'XXXS': 0, 'XXXL': 0}
for i in range(n):
	s = input()
	d[s] = d[s] + 1
q = {'L': 0, 'M': 0, 'S': 0, 'XS': 0, 'XL': 0, 'XXS': 0, 'XXL': 0, 'XXXS': 0, 'XXXL': 0}
for i in range(n):
	s = input()
	q[s] = q[s] + 1
for s in k:
	p = min(d[s], q[s])
	d[s] -= p
	q[s] -= p
c = 0
for s in k:
	if d[s] != 0:
		c += d[s]
print(c)


n = int(input())
a = []
b = []
for i in range(n):
	a.append(input())
for i in range(n):
	k = input()
	if k in a:
		a.remove(k)
	else:
		b.append(k)
c = [0, 0, 0, 0]
for i in range(len(a)):
	c[len(a[i]) - 1] += 1
print(sum(c))


n = int(input())
d = dict()
d1 = dict()
for i in range(n):
	l = input()
	if l not in d:
		d[l] = 1
	else:
		d[l] += 1
x = 0
for i in range(n):
	l = input()
	if l in d1:
		d1[l] += 1
	else:
		d1[l] = 1
for i in d1:
	if i in d:
		x += max(d1[i] - d[i], 0)
	else:
		x += d1[i]
print(x)


n = int(input())
r = {'S': 0, 'M': 0, 'L': 0, 'XS': 0, 'XL': 0, 'XXS': 0, 'XXL': 0, 'XXXS': 0, 'XXXL': 0}
s = {'S': 0, 'M': 0, 'L': 0, 'XS': 0, 'XL': 0, 'XXS': 0, 'XXL': 0, 'XXXS': 0, 'XXXL': 0}
for i in range(n):
	r[input()] += 1
for i in range(n):
	s[input()] += 1
count = n
for k in r.keys():
	count -= min(r[k], s[k])
print(count)


n = int(input())
a = []
b = []
for j in range(n):
	a += [input()]
for j in range(n):
	i = input()
	if i in a:
		a.remove(i)
	else:
		b += [i]
print(len(b))


n = int(input())
arr1 = []
arr2 = []
c = 0
for i in range(n):
	arr1.append(input())
for i in range(n):
	arr2.append(input())
for i in range(n):
	for j in range(n):
		if arr1[i] != -1 and arr2[j] != -1 and (arr1[i] == arr2[j]):
			arr1[i] = -1
			arr2[j] = -1
for i in range(n):
	if arr1[i] != -1:
		c += 1
print(c)


def dell(a, b):
	for i in a:
		if i in b:
			b.remove(i)
			a.remove(i)
			x = dell(a, b)
			a = x[0]
			b = x[1]
			break
	return [a, b]
n = int(input())
n1 = []
n2 = []
n3 = []
n4 = []
m1 = []
m2 = []
m3 = []
m4 = []
for i in range(n):
	s = input()
	if len(s) == 1:
		n1.append(s)
	elif len(s) == 2:
		n2.append(s)
	elif len(s) == 3:
		n3.append(s)
	else:
		n4.append(s)
for i in range(n):
	s = input()
	if len(s) == 1:
		m1.append(s)
	elif len(s) == 2:
		m2.append(s)
	elif len(s) == 3:
		m3.append(s)
	else:
		m4.append(s)
(n1, m1) = dell(n1, m1)
(n2, m2) = dell(n2, m2)
(n3, m3) = dell(n3, m3)
(n4, m4) = dell(n4, m4)
s = n1 + n2 + n3 + n4
s1 = m1 + m2 + m3 + m4
print(len(s))


n = int(input())
prev = []
this = []
for i in range(n):
	prev.append(input())
for i in range(n):
	this.append(input())
for i in range(n):
	if prev[i] in this:
		this.remove(prev[i])
print(len(this))


n = int(input())
old = []
for i in range(n):
	old.append(input())
new = []
old.sort()
for i in range(n):
	new.append(input())
new.sort()
oldstr = ''
for i in old:
	oldstr += i
newstr = ''
for i in new:
	newstr += i
Old = [[], [], [], []]
New = [[], [], [], []]
length = 1
for i in range(n):
	if len(old[i]) == length:
		pass
	else:
		length += 1
	Old[length - 1].append(old[i])
length = 1
for i in range(n):
	if len(new[i]) == length:
		pass
	else:
		length += 1
	New[length - 1].append(new[i])
count = 0
for i in range(4):
	numsO = [0, 0, 0]
	numsN = [0, 0, 0]
	for j in range(len(Old[i])):
		if 'S' in Old[i][j]:
			numsO[0] += 1
		elif 'M' in Old[i][j]:
			numsO[1] += 1
		elif 'L' in Old[i][j]:
			numsO[2] += 1
	for j in range(len(New[i])):
		if 'S' in New[i][j]:
			numsN[0] += 1
		elif 'M' in New[i][j]:
			numsN[1] += 1
		elif 'L' in New[i][j]:
			numsN[2] += 1
	for j in range(3):
		if numsN[j] > numsO[j]:
			count += numsN[j] - numsO[j]
print(count)


from collections import *
n = int(input())
(l, d) = (Counter(), Counter())
for i in range(n):
	s = input()
	l[s] += 1
for j in range(n):
	s = input()
	d[s] += 1
d.subtract(l)
c = 0
for i in d.items():
	c = c + abs(i[1])
print(c // 2)


n = int(input())
sizes = ['XXXS', 'XXS', 'XS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL']
old = {s: 0 for s in sizes}
for i in range(n):
	old[input()] += 1
new = {s: 0 for s in sizes}
for i in range(n):
	new[input()] += 1
diff = {s: old[s] - new[s] for s in sizes}
long = sum((abs(diff[s]) for s in ('XXXS', 'XXS', 'XS')))
short = max((abs(diff[s]) for s in ('S', 'M', 'L')))
print(long + short)


n = int(input())
a = [*(input() for _ in [0] * n)]
c = 0
for _ in [0] * n:
	try:
		a.remove(input())
	except:
		c += 1
print(c)


k = 0
n = int(input())
m = [''] * n
for i in range(n):
	m[i] = [0] + [True]
for i in range(n):
	m[i][0] = input()
for i in range(n):
	loc = input()
	for i in range(n):
		if loc == m[i][0] and m[i][1]:
			m[i][1] = False
			k += 1
			break
print(n - k)


n = int(input())
(a, b) = ([], [])
for i in range(n):
	a.append(str(input()))
for i in range(n):
	b.append(str(input()))
(c, f) = (0, [False for i in range(n)])
for i in range(n):
	l = len(b)
	for j in range(l):
		if a[i] == b[j]:
			f[i] = True
			b.pop(j)
			break
l = len(b)
for i in range(l):
	mn = len(b[i])
	for j in range(n):
		if f[j] == False:
			if len(b[i]) == len(a[j]):
				(c1, lb) = (0, len(b[i]))
				for k in range(lb):
					if b[i][k] != a[j][k]:
						c1 += 1
				if mn >= c1:
					mn = c1
					ind = j
	f[ind] = True
	c += mn
print(c)


n = int(input())
a = []
aa = []
bb = []
for i in range(0, 9):
	aa.append(0)
for i in range(0, 9):
	bb.append(0)
for i in range(0, n):
	s = input()
	if s == 'M':
		aa[0] += 1
	elif s == 'S':
		aa[1] += 1
	elif s == 'L':
		aa[2] += 1
	elif s == 'XS':
		aa[3] += 1
	elif s == 'XL':
		aa[4] += 1
	elif s == 'XXS':
		aa[5] += 1
	elif s == 'XXL':
		aa[6] += 1
	elif s == 'XXXS':
		aa[7] += 1
	elif s == 'XXXL':
		aa[8] += 1
	a.append(s)
b = []
for i in range(0, n):
	s = input()
	if s == 'M':
		bb[0] += 1
	elif s == 'S':
		bb[1] += 1
	elif s == 'L':
		bb[2] += 1
	elif s == 'XS':
		bb[3] += 1
	elif s == 'XL':
		bb[4] += 1
	elif s == 'XXS':
		bb[5] += 1
	elif s == 'XXL':
		bb[6] += 1
	elif s == 'XXXS':
		bb[7] += 1
	elif s == 'XXXL':
		bb[8] += 1
	b.append(s)
count1 = 0
for i in range(0, 9):
	if aa[i] > bb[i]:
		count1 += aa[i] - bb[i]
	else:
		count1 += bb[i] - aa[i]
count1 = count1 / 2
print(int(count1))


from math import ceil, log
t = 1
for test in range(t):
	n = int(input())
	arr = []
	arr2 = []
	for i in range(n):
		arr.append(input())
	for i in range(n):
		arr2.append(input())
	ans = n
	counter = 0
	for i in arr2:
		counter = 0
		for j in arr:
			if i == j:
				ans -= 1
				arr.pop(counter)
				break
			counter += 1
	print(ans)


n = int(input())
a = []
b = []
for i in range(n):
	a.append(input())
for j in range(n):
	s = input()
	if s in a:
		a.remove(s)
print(len(a))


n = int(input())
li1 = []
li2 = []
for i in range(n):
	li1.append(input())
for i in range(n):
	li2.append(input())
a1 = max(li1.count('XXXS') - li2.count('XXXS'), 0)
a2 = max(li1.count('XXS') - li2.count('XXS'), 0)
a3 = max(li1.count('XS') - li2.count('XS'), 0)
a4 = max(li1.count('S') - li2.count('S'), 0)
a5 = max(li1.count('M') - li2.count('M'), 0)
a6 = max(li1.count('L') - li2.count('L'), 0)
a7 = max(li1.count('XL') - li2.count('XL'), 0)
a8 = max(li1.count('XXL') - li2.count('XXL'), 0)
a9 = max(li1.count('XXXL') - li2.count('XXXL'), 0)
print(a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9)


n = int(input())
seta = []
setb = []
for i in range(n):
	seta.append(input())
for i in range(n):
	setb.append(input())
ans = 0
for sa in seta:
	if sa in setb:
		setb.remove(sa)
	else:
		ans += 1
print(ans)


n = int(input())
ly = []
ty = []
r = 0
for i in range(n):
	x = input()
	ly.append(x)
for i in range(n):
	y = input()
	ty.append(y)
for i in range(n):
	if ty[i] not in ly:
		r = r + 1
	else:
		ly.remove(ty[i])
print(r)


num = int(input())
(old, new) = (list(), list())
for i in range(num):
	old.append(input())
for i in range(num):
	new.append(input())
old_map = {i: 0 for i in old}
new_map = {i: 0 for i in new}
for i in range(num):
	old_map[old[i]] += 1
	new_map[new[i]] += 1
ans = num
for i in old_map.items():
	try:
		ans -= min(i[1], new_map[i[0]])
	except:
		pass
print(ans)


n = int(input())
l = [input() for x in range(n)]
ans = 0
for _ in range(n):
	x = input()
	if l.count(x) >= 1:
		l.remove(x)
	else:
		ans += 1
print(ans)


n = int(input())
ans = 0
old = []
for i in range(n):
	old.append(input())
for i in range(n):
	s = input()
	try:
		old.remove(s)
	except:
		ans += 1
print(ans)


n = int(input())
from collections import Counter
(a, b) = ([], [])
for _ in range(n):
	a.append(input().strip())
for _ in range(n):
	b.append(input().strip())
a = Counter(a)
b = Counter(b)
cnt = 0
for (x, c) in a.items():
	if x not in b:
		cnt += c
	else:
		cnt += c - min(c, b[x])
print(cnt)


n = int(input())
L1 = [[] for i in range(5)]
L2 = [[] for i in range(5)]
ans = 0
for i in range(n):
	a = input()
	L1[len(a)].append(a)
for j in range(n):
	b = input()
	L2[len(b)].append(b)
s = 0
m = 0
l = 0
for i in L1[1]:
	if i == 'S':
		s += 1
	elif i == 'M':
		m += 1
	else:
		l += 1
s1 = 0
m1 = 0
l1 = 0
for i in L2[1]:
	if i == 'S':
		s1 += 1
	elif i == 'M':
		m1 += 1
	else:
		l1 += 1
ans += (abs(m - m1) + abs(s - s1) + abs(l - l1)) // 2
for i in range(2, 5):
	s = 0
	l = 0
	s1 = 0
	l1 = 0
	for j in range(len(L1[i])):
		if L1[i][j][i - 1] == 'S':
			s += 1
		else:
			l += 1
		if L2[i][j][i - 1] == 'S':
			s1 += 1
		else:
			l1 += 1
	ans += (abs(l - l1) + abs(s - s1)) // 2
print(ans)


n = int(input())
(a, b) = ([], [])
for i in range(n):
	a += [[input(), 0]]
for i in range(n):
	b += [[input(), 0]]
l = len(a)
for i in range(l):
	for j in range(l):
		if a[i][0] == b[j][0] and a[i][1] == 0 and (b[j][1] == 0):
			a[i][1] = 1
			b[j][1] = 1
c = 0
for i in range(l):
	if a[i][1] == 0:
		c += 1
print(c)


from math import sqrt
for _ in range(1):
	n = int(input())
	a = []
	b = []
	for i in range(n):
		a.append(input())
	for i in range(n):
		b.append(input())
	diff = []
	for i in b:
		if i not in a:
			diff.append(b)
		else:
			a.remove(i)
	if len(diff) == 0:
		print(0)
	else:
		print(len(a))


def go():
	n = int(input())
	a = []
	b = []
	a_d = {}
	for i in range(n):
		x = input()
		a.append(x)
		a_d.setdefault(x, 0)
		a_d[x] += 1
	for i in range(n):
		x = input()
		if x in a_d:
			a_d[x] -= 1
			a.remove(x)
			if a_d[x] == 0:
				a_d.pop(x)
		else:
			b.append(x)
	if len(b) == 0:
		return 0
	total = 0
	a = list(sorted(a, key=lambda x: len(x)))
	b = list(sorted(b, key=lambda x: len(x)))
	for i in range(len(a)):
		if a[i] == 1:
			total += 1
		else:
			for j in range(len(a[i])):
				if a[i][j] != b[i][j]:
					total += 1
	return total
print(go())


n = int(input())
o = {}
for i in range(n):
	s = input()
	if s in o:
		o[s] += 1
	else:
		o[s] = 1
for i in range(n):
	s = input()
	if s in o:
		o[s] -= 1
	else:
		o[s] = -1
total = 0
for key in o:
	total += abs(o[key])
print(str(int(total / 2)))


n = int(input())
l1 = []
l2 = []
for i in range(n):
	l1.append(input())
for i in range(n):
	l2.append(input())
l = []
for i in l1:
	if i not in l2:
		l.append(i)
	else:
		del l2[l2.index(i)]
print(len(l))


n = int(input())
a = []
for i in range(0, n):
	p = input()
	a.append(p)
b = []
for i in range(0, n):
	p = input()
	b.append(p)
for i in range(0, len(b)):
	if b[i] in a:
		a.remove(b[i])
print(len(a))


import sys
import io
stream_enable = 0
inpstream = '\n3\nXS\nXS\nM\nXL\nS\nXS\n'
if stream_enable:
	sys.stdin = io.StringIO(inpstream)
	input()

def inpmap():
	return list(map(int, input().split()))
n = int(input())
a = []
b = []
for i in range(n):
	a.append(input())
for i in range(n):
	b.append(input())
m = 0
for x in a:
	if x in b:
		b.remove(x)
	else:
		m += 1
print(m)


n = int(input())
s1 = []
s2 = []
for a in range(n):
	s1.append(input())
for a in range(n):
	x = input()
	if x in s1:
		s1.remove(x)
	else:
		s2.append(x)
print(len(s1))


t = int(input())
pre = []
curr = []
for i in range(t):
	s1 = input()
	pre.append(s1)
for i in range(t):
	s2 = input()
	curr.append(s2)
z = 0
for i in range(t):
	if pre[i] in curr:
		curr.remove(pre[i])
		pass
	else:
		z += 1
print(z)


n = int(input())
l1 = []
l2 = []
for i in range(n):
	l1.append(input())
for i in range(n):
	l2.append(input())
for i in range(len(l1)):
	if l1[i] in l2:
		l2.pop(l2.index(l1[i]))
print(len(l2))


n = int(input())
a = []
i = 0
for i in range(n):
	s = input()
	a.append(s)
for i in range(n):
	s = input()
	if s in a:
		a.remove(s)
print(len(a))


l = [[] for i in range(4)]
l1 = [[] for i in range(4)]
n = int(input())
for i in range(n):
	count = 0
	r = input()
	for j in r:
		if j == 'X':
			count = count + 1
		else:
			break
	l[count].append(r)
for i in range(n):
	count = 0
	r = input()
	for j in r:
		if j == 'X':
			count = count + 1
		else:
			break
	l1[count].append(r)
ans = 0
for i in range(4):
	for k in l[i]:
		r = len(l1[i])
		for u in range(r):
			if l1[i][u] == k:
				l1[i].pop(u)
				break
	ans = ans + len(l1[i])
print(ans)


N = int(input())
N1 = N
L = []
N2 = N
L1 = []
while N > 0:
	S = input()
	L1.append(S)
	N = N - 1
while N1 > 0:
	S = input()
	L.append(S)
	N1 = N1 - 1
j = 0
for i in range(0, N2):
	if L1[i] not in L:
		j = j + 1
	else:
		R = L.index(L1[i])
		L[R] = -1
print(j)


n = int(input())
a = [input() for _ in range(n)]
b = [input() for _ in range(n)]
cost = 0
for s in ['M', 'S', 'XS', 'XXS', 'XXXS', 'L', 'XL', 'XXL', 'XXXL']:
	ca = a.count(s)
	cb = b.count(s)
	cost += ca - min(ca, cb)
print(cost)


import re
import math
import decimal
import bisect

def read():
	return input().strip()

def iread():
	return int(input().strip())

def viread():
	return list(map(int, input().strip().split()))
n = iread()
lastyr = []
for i in range(n):
	lastyr.append(read())
curyr = []
ops = 0
for i in range(n):
	shirt = read()
	if shirt in lastyr:
		lastyr.remove(shirt)
	else:
		curyr.append(shirt)
while len(lastyr) > 0:
	s = lastyr.pop()
	best = [10000000, None]
	for other in curyr:
		if len(other) != len(s):
			continue
		diff = 0
		for i in range(len(s)):
			if s[i] != other[i]:
				diff += 1
		if diff < best[0]:
			best[0] = diff
			best[1] = other
	curyr.remove(best[1])
	ops += best[0]
print(ops)


n = int(input())
arr10 = []
arr11 = []
arr12 = []
arr13 = []
arr20 = []
arr21 = []
arr22 = []
arr23 = []
for i in range(n):
	s = str(input())
	k = s.count('X')
	if k == 0:
		arr10.append(s)
	elif k == 1:
		arr11.append(s)
	elif k == 2:
		arr12.append(s)
	elif k == 3:
		arr13.append(s)
for i in range(n):
	s = str(input())
	k = s.count('X')
	if k == 0:
		arr20.append(s)
	elif k == 1:
		arr21.append(s)
	elif k == 2:
		arr22.append(s)
	elif k == 3:
		arr23.append(s)
ans = 0
arr10.sort()
arr20.sort()
for i in range(len(arr10)):
	if arr10[i] in arr20:
		z = arr20.index(arr10[i])
		arr20[z] = 'Z'
	else:
		ans += 1
arr11.sort()
arr21.sort()
for i in range(len(arr11)):
	if arr11[i] in arr21:
		z = arr21.index(arr11[i])
		arr21[z] = 'Z'
	else:
		ans += 1
arr12.sort()
arr22.sort()
for i in range(len(arr12)):
	if arr12[i] in arr22:
		z = arr22.index(arr12[i])
		arr22[z] = 'Z'
	else:
		ans += 1
arr13.sort()
arr23.sort()
for i in range(len(arr13)):
	if arr13[i] in arr23:
		z = arr23.index(arr13[i])
		arr23[z] = 'Z'
	else:
		ans += 1
print(ans)


nos = int(input())
last_year = []
curr_year = []
needed = 0
for i in range(nos):
	last_year.append(input())
for i in range(nos):
	curr_year.append(input())
for i in last_year:
	if i in curr_year:
		curr_year.pop(curr_year.index(i))
print(len(curr_year))


import sys
n = int(sys.stdin.readline())
s = list()
t = n
for z in range(n):
	a = sys.stdin.readline()
	find = False
	for loop in range(len(s)):
		if s[loop][0] == a:
			find = True
			s[loop][1] += 1
	if not find:
		s.append([a, 1])
for z in range(n):
	a = sys.stdin.readline()
	find = False
	for loop in range(len(s)):
		if s[loop][0] == a and s[loop][1] > 0:
			find = True
			s[loop][1] -= 1
			t -= 1
print(t)


n = int(input())
a = []
b = []
for i in range(n):
	x = input()
	a.append(x)
for i in range(n):
	y = input()
	b.append(y)
sum = 0
for i in b:
	if i in a:
		a.remove(i)
		continue
	else:
		sum += 1
print(sum)


n = int(input())
a = {}
b = {}
for i in range(n):
	temp = input()
	if temp in a:
		a[temp] += 1
	else:
		a[temp] = 1
for i in range(n):
	temp = input()
	if temp in b:
		b[temp] += 1
	else:
		b[temp] = 1
counter = 0
for i in b.keys():
	if i in a:
		if b[i] > a[i]:
			b[i] -= a[i]
		else:
			b[i] = 0
	counter += b[i]
print(counter)


def solve():
	n = int(input())
	a_dicts = [{}, {}]
	for j in range(2):
		for i in range(n):
			x = input()
			if x in a_dicts[j]:
				a_dicts[j][x] += 1
			else:
				a_dicts[j][x] = 1
			if x not in a_dicts[1 - j]:
				a_dicts[1 - j][x] = 0
	c = 0
	for k in a_dicts[0]:
		c += abs(a_dicts[0][k] - a_dicts[1][k])
	return c // 2
print(solve())


n = int(input())
a = [input() for i in range(n)]
b = [input() for i in range(n)]
to_remove = []
for s in a:
	if s in b:
		b.remove(s)
		to_remove += [s]
for s in to_remove:
	a.remove(s)
a.sort()
b.sort()
ans = 0
for i in range(len(a)):
	if a[i][-1] != b[i][-1]:
		ans += 1
print(ans)


n = int(input())
l1 = []
for i in range(n):
	s = str(input())
	l1.append(s)
l2 = []
for i in range(n):
	s = str(input())
	l2.append(s)
for t in l1:
	if t in l2:
		l2.remove(t)
print(len(l2))


n = int(input())
f = 0
mas = []
gas = []
for a in range(n):
	mas.append(input())
for b in range(n):
	k = input()
	if k in mas:
		del mas[mas.index(k)]
	else:
		gas.append(k)
for a in mas:
	for b in gas:
		if len(a) == len(b) and b[-2:] != 'OK':
			for i in range(len(a)):
				if a[i] != b[i]:
					f += 1
			b += 'OK'
			break
print(f)


n = int(input())
(a, b) = ([], [])
for _ in range(n):
	a.append(input())
for _ in range(n):
	k = input()
	if k in a:
		a.remove(k)
print(len(a))


import collections
n = int(input())
a = []
b = []
for i in range(n):
	s = input()
	a.append(s)
for i in range(n):
	s = input()
	b.append(s)
an = dict(collections.Counter(a))
bn = dict(collections.Counter(b))
p = n
for (i, j) in an.items():
	if i in bn.keys():
		p -= min(j, bn[i])
print(p)


import math
getInputList = lambda : list(input().split())
getInputIntList = lambda : list(map(int, input().split()))
n = int(input())
arr1 = []
for i in range(n):
	arr1.append(input())
arr2 = []
for i in range(n):
	arr2.append(input())
count = 0
for i in arr1:
	for j in arr2:
		if i == j:
			arr2.remove(j)
			break
	else:
		count += 1
print(count)


l1 = [0, 0, 0, 0, 0, 0, 0, 0, 0]
l2 = [0, 0, 0, 0, 0, 0, 0, 0, 0]
a = int(input())
for i in range(a):
	k = input()
	if k == 'XXXS':
		l1[0] += 1
	if k == 'XXS':
		l1[1] += 1
	if k == 'XS':
		l1[2] += 1
	if k == 'S':
		l1[3] += 1
	if k == 'M':
		l1[4] += 1
	if k == 'L':
		l1[5] += 1
	if k == 'XL':
		l1[6] += 1
	if k == 'XXL':
		l1[7] += 1
	if k == 'XXXL':
		l1[8] += 1
for i in range(a):
	k = input()
	if k == 'XXXS':
		l2[0] += 1
	if k == 'XXS':
		l2[1] += 1
	if k == 'XS':
		l2[2] += 1
	if k == 'S':
		l2[3] += 1
	if k == 'M':
		l2[4] += 1
	if k == 'L':
		l2[5] += 1
	if k == 'XL':
		l2[6] += 1
	if k == 'XXL':
		l2[7] += 1
	if k == 'XXXL':
		l2[8] += 1
s = 0
for i in range(len(l1)):
	if l1[i] < l2[i]:
		s += l2[i] - l1[i]
print(s)


from collections import defaultdict
t = int(input())
previous = []
present = []
dict1 = defaultdict(int)
dict2 = defaultdict(int)
for i in range(t):
	word = input()
	previous.append(word)
	dict1[word] += 1
for i in range(t):
	word = input()
	present.append(word)
	dict2[word] += 1
intersection = list(set(previous) & set(present))
valid = 0
for i in range(len(intersection)):
	valid += min(dict1[intersection[i]], dict2[intersection[i]])
print(len(previous) - valid)


from collections import Counter
n = int(input())
a = Counter((input().strip() for _ in range(n)))
b = Counter((input().strip() for _ in range(n)))
for sz in ['M', 'L', 'XL', 'XXL', 'XXXL', 'S', 'XS', 'XXS', 'XXXS']:
	m = min(a[sz], b[sz])
	a[sz] -= m
	b[sz] -= m
ans = 0
for num_x in range(1, 4):
	old = a['X' * num_x + 'S'] + a['X' * num_x + 'L']
	new = b['X' * num_x + 'S'] + b['X' * num_x + 'L']
	assert old == new
	ans += old
old = a['M'] + a['S'] + a['L']
new = b['M'] + b['S'] + b['L']
assert old == new
ans += old
print(ans)


l = ['S', 'X', 'M', 'L']
dly = {i: [] for i in l}
dty = {i: [] for i in l}
n = int(input())
ly = [input() for i in range(n)]
for i in ly:
	dly[i[0]].append(i[1:])
ty = [input() for i in range(n)]
for i in ty:
	dty[i[0]].append(i[1:])
t = 0
for i in dly:
	if len(dly[i]) != 0:
		for j in dly[i]:
			for k in dty[i]:
				if j == k:
					dty[i].remove(k)
					break
			else:
				t += 1
print(t)


def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())
n = int(input())
a = [input().strip() for i in range(n)]
b = [input().strip() for i in range(n)]
ans = 0
c = [0, 0, 0]
d = [0, 0, 0]
for (i, ss) in enumerate(['S', 'L', 'M']):
	c[i] = a.count(ss)
	d[i] = b.count(ss)
	x = min(c[i], d[i])
	c[i] -= x
	d[i] -= x
ans += sum(d)
c = [0, 0]
d = [0, 0]
for (i, ss) in enumerate(['XS', 'XL']):
	c[i] = a.count(ss)
	d[i] = b.count(ss)
	x = min(c[i], d[i])
	c[i] -= x
	d[i] -= x
ans += sum(d)
c = [0, 0]
d = [0, 0]
for (i, ss) in enumerate(['XXS', 'XXL']):
	c[i] = a.count(ss)
	d[i] = b.count(ss)
	x = min(c[i], d[i])
	c[i] -= x
	d[i] -= x
ans += sum(d)
c = [0, 0]
d = [0, 0]
for (i, ss) in enumerate(['XXXS', 'XXXL']):
	c[i] = a.count(ss)
	d[i] = b.count(ss)
	x = min(c[i], d[i])
	c[i] -= x
	d[i] -= x
ans += sum(d)
print(ans)


n = int(input())
a = dict()
b = dict()
for i in range(0, n):
	s = input()
	if s in a:
		a[s] += 1
	else:
		a[s] = 1
		b[s] = 0
for i in range(0, n):
	s = input()
	if s in b:
		b[s] += 1
ans = 0
for (k, v) in a.items():
	if a[k] > b[k]:
		ans += a[k] - b[k]
print(ans)


n = int(input())
l = []
ll = []
for i in range(n):
	nn = input()
	l.append(nn)
for i in range(n):
	nn = input()
	ll.append(nn)
l.sort()
ll.sort()
c = 0
for i in range(n):
	if l[i] in ll:
		ll.remove(l[i])
	else:
		c += 1
print(c)


n = int(input())
old = []
new = []
for i in range(n):
	old.append(input())
for j in range(n):
	new.append(input())
old.sort()
c = 0
for o in old:
	if o in new:
		new.remove(o)
	else:
		c += 1
print(c)


n = int(input())
pre = [[0 for i in range(3)] for i in range(4)]
cur = [[0 for i in range(3)] for i in range(4)]
for i in range(n):
	s = input()
	l = len(s)
	if s[l - 1] == 'S':
		pre[l - 1][0] += 1
	elif s[l - 1] == 'M':
		pre[l - 1][1] += 1
	else:
		pre[l - 1][2] += 1
for i in range(n):
	s = input()
	l = len(s)
	if s[l - 1] == 'S':
		cur[l - 1][0] += 1
	elif s[l - 1] == 'M':
		cur[l - 1][1] += 1
	else:
		cur[l - 1][2] += 1
ans = 0
for i in range(4):
	for j in range(3):
		if cur[i][j] > pre[i][j]:
			ans += cur[i][j] - pre[i][j]
print(ans)


import sys
from array import array
from collections import Counter
n = int(input())
(cnt1, cnt2) = (Counter(), Counter())
for _ in range(n):
	cnt1[input()] += 1
for _ in range(n):
	cnt2[input()] += 1
ans = 0
for prefix in ('', 'X', 'XX', 'XXX'):
	total = cnt1[prefix + 'S'] + cnt1[prefix + 'M'] + cnt1[prefix + 'L']
	for suffix in ('S', 'M', 'L'):
		total -= min(cnt1[prefix + suffix], cnt2[prefix + suffix])
	ans += total
print(ans)


from collections import Counter
cnt = Counter()
n = int(input())
for _ in range(n):
	cnt[input()] += 1
for __ in range(n):
	cnt[input()] -= 1
print(sum(map(abs, cnt.values())) // 2)


n = int(input())
a = []
b = []
for i in range(2 * n):
	s = input()
	if i < n:
		a.append(s)
	else:
		b.append(s)
c = 0
i = 0
while i < len(a):
	if a[i] in b:
		ind = b.index(a[i])
		del a[i]
		del b[ind]
	else:
		i += 1
		c += 1
print(c)


from collections import Counter
n = int(input())
a = Counter()
b = Counter()
for _ in range(n):
	a[input().strip()] += 1
for _ in range(n):
	b[input().strip()] += 1
ans = 0
for key in b:
	ans += max(b[key] - a[key], 0)
print(ans)


from collections import Counter
n = int(input())
a = Counter([input() for _ in range(n)])
b = Counter([input() for _ in range(n)])
for (key, value) in a.items():
	if key in b:
		if value >= b[key]:
			a[key] = value - b[key]
			b[key] = 0
		else:
			b[key] = b[key] - value
			a[key] = 0
av = a.values()
if av:
	print(sum(av))
else:
	print(0)


n = int(input().strip())
ans = 0
d = {'S': 0, 'M': 0, 'L': 0, 'XS': 0, 'XL': 0, 'XXS': 0, 'XXL': 0, 'XXXS': 0, 'XXXL': 0}
for i in range(n):
	d[input().strip()] += 1
d2 = {'S': 0, 'M': 0, 'L': 0, 'XS': 0, 'XL': 0, 'XXS': 0, 'XXL': 0, 'XXXS': 0, 'XXXL': 0}
for i in range(n):
	d2[input().strip()] += 1
for i in d2.keys():
	ans += max(d2[i] - d[i], 0)
print(ans)


(n, d) = (int(input()), {})
for i in range(n * 2):
	s = input()
	d[s] = d.get(s, 0) + (1, -1)[i < n]
print(sum((v for v in d.values() if v > 0)))


n = int(input())
pre = []
cur = []
for i in range(n):
	pre.append(input())
for i in range(n):
	cur.append(input())
num = 0
for i in range(n):
	if pre[i] in cur:
		cur.remove(pre[i])
	else:
		num += 1
print(num)


def separator(p):
	c = 0
	d = 0
	e = 0
	f = 0
	g = 0
	h = 0
	k = 0
	l = 0
	m = 0
	for i in p:
		if i == 'S':
			c += 1
		elif i == 'M':
			d += 1
		elif i == 'L':
			e += 1
		elif i == 'XS':
			f += 1
		elif i == 'XXS':
			g += 1
		elif i == 'XXXS':
			h += 1
		elif i == 'XL':
			k += 1
		elif i == 'XXL':
			l += 1
		elif i == 'XXXL':
			m += 1
	z = [c, d, e, f, g, h, k, l, m]
	return z
n = int(input(''))
a = []
b = []
count = 0
for x in range(n):
	p = input('')
	a.append(p)
for y in range(n):
	q = input('')
	b.append(q)
z_1 = separator(a)
z_2 = separator(b)
for i in range(9):
	if z_1[i] - z_2[i] > 0:
		count = count + (z_1[i] - z_2[i])
print(count)


n = int(input())
last = []
this = []
for z in range(n):
	t = str(input())
	last.append(t)
for y in range(n):
	u = str(input())
	this.append(u)
xxxs = min(last.count('XXXS'), this.count('XXXS'))
xxs = min(last.count('XXS'), this.count('XXS'))
xs = min(last.count('XS'), this.count('XS'))
s = min(last.count('S'), this.count('S'))
m = min(last.count('M'), this.count('M'))
l = min(last.count('L'), this.count('L'))
xl = min(last.count('XL'), this.count('XL'))
xxl = min(last.count('XXL'), this.count('XXL'))
xxxl = min(last.count('XXXL'), this.count('XXXL'))
print(n - (xxxs + xxs + xs + s + m + l + xl + xxl + xxxl))


from collections import Counter
n = int(input())
first = Counter([input() for _ in range(n)])
second = Counter([input() for _ in range(n)])
diff = [first.get(key, 0) - second.get(key, 0) for key in set(first.keys()) | set(second.keys())]
print(sum(filter(lambda x: x > 0, diff)))


import sys
import string
from collections import Counter, defaultdict
from math import fsum, sqrt, gcd, ceil, factorial
from operator import add
inf = float('inf')
flush = lambda : sys.stdout.flush
comb = lambda x, y: factorial(x) // factorial(y) // factorial(x - y)
ip = lambda : input()
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())
n = ii()
arr = [ip() for _ in range(n)]
brr = [ip() for _ in range(n)]
c = 0
for i in brr:
	try:
		arr.remove(i)
	except:
		c += 1
print(c)


lis = ['M', 'L', 'S', 'XL', 'XS', 'XXL', 'XXS', 'XXXL', 'XXXS']
m1 = dict()
m2 = dict()
for item in lis:
	m1[item] = 0
	m2[item] = 0
n = int(input())
for i in range(n):
	s = input()
	m1[s] += 1
for i in range(n):
	s = input()
	m2[s] += 1
ans = 0
for item in m1:
	ans += abs(m1[item] - m2[item])
print(int(ans / 2))


n = int(input())
a = [input() for x in range(0, n)]
b = [input() for x in range(n, 2 * n)]
c = 0
for x in b:
	if x in a:
		a.remove(x)
	elif x not in a:
		c = c + 1
print(c)


n = int(input())
temp1 = []
temp2 = []
for i in range(n):
	temp1.append(input())
for i in range(n):
	temp2.append(input())
a = [[]] * 5
b = [[]] * 5
cnt = 0
for i in temp1:
	k = len(i) - 1
	a[k] = a[k] + [i]
for i in temp2:
	k = len(i) - 1
	b[k] = b[k] + [i]
for i in range(5):
	m1 = a[i].count('M')
	m2 = b[i].count('M')
	s1 = a[i].count('X' * i + 'S')
	s2 = b[i].count('X' * i + 'S')
	l1 = len(a) - m1 - s1
	l2 = len(b) - m2 - s2
	cnt += int((abs(m1 - m2) + abs(s1 - s2) + abs(l1 - l2)) / 2)
print(cnt)


while True:
	try:

		def read():
			n = int(input())
			p = list()
			for i in range(n):
				p.append(input())
			for i in range(n):
				n = input()
				if n in p:
					p.remove(n)
			print(len(p))
		if __name__ == '__main__':
			read()
	except EOFError:
		break


from collections import defaultdict as di
n = int(input())
d = di(int)
res = 0
for i in range(n):
	d[input()] += 1
b = []
for i in range(n):
	b.append(input())
for i in range(n):
	if d.get(b[i], 0) != 0:
		d[b[i]] -= 1
	else:
		res += 1
print(res)


n = int(input())
a = [input() for i in range(n)]
b = [input() for i in range(n)]
xxxc = abs(a.count('XXXS') - b.count('XXXS'))
xxc = abs(a.count('XXS') - b.count('XXS'))
xc = abs(a.count('XS') - b.count('XS'))
cs = a.count('S') - b.count('S')
cm = a.count('M') - b.count('M')
cl = a.count('L') - b.count('L')
c = 0
if cs > 0:
	c += cs
if cm > 0:
	c += cm
if cl > 0:
	c += cl
print(xxxc + xxc + xc + c)


n = int(input())
dic = {}
for i in range(n):
	s = input()
	if s in dic:
		dic[s] = dic[s] + 1
	else:
		dic[s] = 1
count = 0
for i in range(n):
	s = input()
	if s in dic:
		if dic[s] <= 0:
			count += 1
		dic[s] -= 1
	else:
		count += 1
print(count)


n = int(input())
old = []
for a0 in range(n):
	old.append(input())
new = []
for a0 in range(n):
	new.append(input())
ans = 0
ans += abs(old.count('XS') - new.count('XS'))
ans += abs(old.count('XXS') - new.count('XXS'))
ans += abs(old.count('XXXS') - new.count('XXXS'))
if new.count('S') > old.count('S'):
	ans += abs(old.count('S') - new.count('S'))
if new.count('M') > old.count('M'):
	ans += abs(old.count('M') - new.count('M'))
if new.count('L') > old.count('L'):
	ans += abs(old.count('L') - new.count('L'))
print(ans)


import sys
import collections

def readArray(type=int):
	line = input()
	return [type(x) for x in line.split()]

def getFreq(array):
	freq = collections.defaultdict(int)
	for x in array:
		freq[x] += 1
	return freq

def solve():
	cost = 0
	n = int(input())
	ap = [input() for x in range(n)]
	ac = [input() for x in range(n)]
	apf = getFreq(ap)
	acf = getFreq(ac)
	for k in acf.keys():
		diff = abs(apf[k] - acf[k])
		if apf[k] < acf[k]:
			cost += diff
			apf[k] -= diff
	print(cost)
solve()


def can_change(a, b):
	return a.replace('S', '') + 'L' == b or a.replace('S', '') + 'M' == b or a.replace('M', '') + 'S' == b or (a.replace('M', '') + 'L' == b) or (a.replace('L', '') + 'S' == b) or (a.replace('L', '') + 'M' == b)
n = int(input())
lia = {}
for i in range(2 * n):
	if i >= n:
		b = input()
		if b in lia:
			lia[b] -= 1
		else:
			lia[b] = 0
	else:
		a = input()
		if a in lia:
			lia[a] += 1
		else:
			lia[a] = 1
ans = 0
for v in lia.values():
	if v > 0:
		ans += v
print(ans)


import collections
from functools import cmp_to_key
import math
import sys

def getIntList():
	return list(map(int, input().split()))
import bisect
try:
	import numpy
	dprint = print
	dprint('debug mode')
except ModuleNotFoundError:

	def dprint(*args, **kwargs):
		pass

def makePair(z):
	return [(z[i], z[i + 1]) for i in range(0, len(z), 2)]

def memo(func):
	cache = {}

	def wrap(*args):
		if args not in cache:
			cache[args] = func(*args)
		return cache[args]
	return wrap

@memo
def comb(n, k):
	if k == 0:
		return 1
	if n == k:
		return 1
	return comb(n - 1, k - 1) + comb(n - 1, k)
(N,) = getIntList()
z1 = collections.Counter()
z2 = collections.Counter()
for i in range(N):
	a = input()
	z1[a] += 1
for i in range(N):
	a = input()
	if z1[a] > 0:
		z1[a] -= 1
	else:
		z2[a] += 1
res = 0
res = z1['M']
for i in range(4):
	res += z1['X' * i + 'L'] + z1['X' * i + 'S']
print(res)


T = int(input())
b = {}
for i in range(T):
	p = input()
	if p not in b:
		b[p] = 0
	b[p] += 1
for i in range(T):
	p = input()
	if p not in b:
		b[p] = 0
	b[p] -= 1
answer = 0
for j in b:
	if b[j] > 0:
		answer += b[j]
print(answer)


n = int(input())
old = []
new = []
for i in range(n):
	old.append(input())
for i in range(n):
	new.append(input())
changes = n
dold = {}
dnew = {}
for i in old:
	if i in dold:
		dold[i] += 1
	else:
		dold[i] = 1
for i in new:
	if i in dnew:
		dnew[i] += 1
	else:
		dnew[i] = 1
for i in dold.keys():
	if i in dnew.keys():
		if dold[i] - dnew[i] != 0:
			if dold[i] > dnew[i]:
				changes -= dold[i] - (dold[i] - dnew[i])
			if dold[i] < dnew[i]:
				changes -= dnew[i] - (dnew[i] - dold[i])
		else:
			changes -= dold[i]
print(changes)


n = int(input().strip())
x = {}
cnt = 0
for i in range(n):
	s = input().strip()
	if s in x:
		x[s] += 1
	else:
		x[s] = 1
for i in range(n):
	s = input().strip()
	if s in x:
		if x[s] > 0:
			x[s] -= 1
		else:
			cnt += 1
	else:
		cnt += 1
print(cnt)


n = int(input())
first = []
second = []
for i in range(n):
	first.append(input())
for i in range(n):
	second.append(input())
count = 0
for i in range(n):
	if first[i] in second:
		count += 1
		second.remove(first[i])
print(n - count)


R = lambda : map(int, input().split())
n = int(input())
a = {}
for i in range(n):
	k = input()
	if k in a:
		a[k] += 1
	else:
		a[k] = 1
ans = 0
for i in range(n):
	k = input()
	if k in a and a[k] > 0:
		a[k] -= 1
	else:
		ans += 1
print(ans)


from collections import deque as de
import math
from collections import Counter as cnt

class My_stack:

	def __init__(self):
		self.data = []

	def my_push(self, x):
		return self.data.append(x)

	def my_pop(self):
		return self.data.pop()

	def my_peak(self):
		return self.data[-1]

	def my_contains(self, x):
		return self.data.count(x)

	def my_show_all(self):
		return self.data

	def isEmpty(self):
		return len(self.data) == 0
arrStack = My_stack()

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def get_prime_factors(number):
	prime_factors = []
	while number % 2 == 0:
		prime_factors.append(2)
		number = number / 2
	for i in range(3, int(math.sqrt(number)) + 1, 2):
		while number % i == 0:
			prime_factors.append(int(i))
			number = number / i
	if number > 2:
		prime_factors.append(int(number))
	return prime_factors

def get_frequency(list):
	dic = {}
	for ele in list:
		if ele in dic:
			dic[ele] += 1
		else:
			dic[ele] = 1
	return dic
n = int(input())
pp = n
nn = n
pl = []
nl = []
while pp:
	pp -= 1
	pl.append(input())
while nn:
	nn -= 1
	nl.append(input())
ans = 0
pmc = pl.count('M')
mc = nl.count('M')
if pmc < mc:
	ans += mc - pmc
psc = pl.count('S')
sc = nl.count('S')
if psc < sc:
	ans += sc - psc
plc = pl.count('L')
lc = nl.count('L')
if plc < lc:
	ans += lc - plc
pxlc = pl.count('XL')
xlc = nl.count('XL')
if pxlc < xlc:
	ans += xlc - pxlc
pxxlc = pl.count('XXL')
xxlc = nl.count('XXL')
if pxxlc < xxlc:
	ans += xxlc - pxxlc
pxxxlc = pl.count('XXXL')
xxxlc = nl.count('XXXL')
if pxxxlc < xxxlc:
	ans += xxxlc - pxxxlc
pxsc = pl.count('XS')
xsc = nl.count('XS')
if pxsc < xsc:
	ans += xsc - pxsc
pxxsc = pl.count('XXS')
xxsc = nl.count('XXS')
if pxxsc < xxsc:
	ans += xxsc - pxxsc
pxxxsc = pl.count('XXXS')
xxxsc = nl.count('XXXS')
if pxxxsc < xxxsc:
	ans += xxxsc - pxxxsc
print(ans)


n = int(input())
res = 0
(x1, m1, l1, s1) = ([0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0])
(x2, m2, l2, s2) = ([0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0])
for i in range(n):
	inpt = input()
	index = len(inpt) - 1
	x1[index] += inpt.count('X')
	m1[index] += inpt.count('M')
	l1[index] += inpt.count('L')
	s1[index] += inpt.count('S')
for i in range(n):
	inpt = input()
	index = len(inpt) - 1
	x2[index] += inpt.count('X')
	m2[index] += inpt.count('M')
	l2[index] += inpt.count('L')
	s2[index] += inpt.count('S')
for i in range(4):
	res += abs(x1[i] - x2[i])
	res += abs(m1[i] - m2[i])
	res += abs(l1[i] - l2[i])
	res += abs(s1[i] - s2[i])
print(res // 2)


n = int(input().strip())
old_lst = []
for i in range(n):
	size = input().strip()
	old_lst.append(size)
new_lst = []
for i in range(n):
	size = input().strip()
	new_lst.append(size)
time = 0
for size in old_lst:
	if size in new_lst:
		new_lst.remove(size)
	else:
		time += 1
print(time)


n = int(input())
a = {}
c = 0
for i in range(n):
	k = input()
	a[k] = a.get(k, 0) + 1
for i in range(n):
	k = input()
	if k in a and a[k] > 0:
		a[k] -= 1
	else:
		c += 1
print(c)


import time
n = int(input())
start = time.time()
da = {'S': 0, 'XS': 0, 'XXS': 0, 'XXXS': 0, 'M': 0, 'L': 0, 'XL': 0, 'XXL': 0, 'XXXL': 0}
db = da.copy()
for i in range(n):
	da[input()] += 1
for j in range(n):
	db[input()] += 1
ans = abs(da['XXXL'] - db['XXXL']) + abs(da['XXL'] - db['XXL']) + abs(da['XL'] - db['XL'])
s = da['S'] - db['S']
m = da['M'] - db['M']
l = da['L'] - db['L']
if s > 0:
	ans += s
if m > 0:
	ans += m
if l > 0:
	ans += l
print(ans)
finish = time.time()


l1 = []
l2 = []
l3 = ['L', 'M', 'S', 'XL', 'XS', 'XXL', 'XXS', 'XXXL', 'XXXS']
j = 0
n = int(input())
for i in range(n):
	l1.append(input())
for i in range(n):
	l2.append(input())
for i in l3:
	j += abs(l1.count(i) - l2.count(i))
print(j // 2)


n = int(input())
s1 = []
s2 = []
for i in range(n):
	s1.append(input())
for i in range(n):
	s2.append(input())
d1 = {'M': 0, 'S': 0, 'L': 0, 'XS': 0, 'XL': 0, 'XXS': 0, 'XXL': 0, 'XXXS': 0, 'XXXL': 0}
d2 = {'M': 0, 'S': 0, 'L': 0, 'XS': 0, 'XL': 0, 'XXS': 0, 'XXL': 0, 'XXXS': 0, 'XXXL': 0}
for i in range(n):
	d1[s1[i]] += 1
for i in range(n):
	d2[s2[i]] += 1
for i in list(d1.keys()):
	if d1[i] >= d2[i]:
		d1[i] -= d2[i]
		d2[i] = 0
	else:
		d1[i] = 0
print(sum(list(d1.values())))


n = int(input())
prev = [0] * 9
cur = [0] * 9
for i in range(n):
	a = list(str(input()))
	l = len(a)
	if a[-1] == 'S':
		prev[4 - l] += 1
	elif a[-1] == 'L':
		prev[4 + l] += 1
	else:
		prev[4] += 1
for i in range(n):
	a = list(str(input()))
	l = len(a)
	if a[-1] == 'S':
		cur[4 - l] += 1
	elif a[-1] == 'L':
		cur[4 + l] += 1
	else:
		cur[4] += 1
count = 0
for i in range(9):
	if cur[i] - prev[i] > 0:
		count += cur[i] - prev[i]
print(count)


def razmery(lst1, lst2):
	for elem in lst2:
		if elem in lst1:
			lst1.remove(elem)
	return len(lst1)
n = int(input())
a = list()
b = list()
for i in range(n):
	s = input()
	a.append(s)
for j in range(n):
	t = input()
	b.append(t)
print(razmery(a, b))


(oldArray, newArray) = ([], [])
result = 0
number = int(input())
for i in range(0, number):
	bar = input()
	oldArray.append(bar)
for i in range(0, number):
	bar = input()
	if bar in set(oldArray):
		oldArray.remove(bar)
	else:
		newArray.append(bar)
for i in oldArray:
	if len(i) == 1:
		result += 1
	else:
		T = 0
		v = len(i)
		for g in newArray:
			if len(g) == v:
				t = 0
				for y in range(0, v):
					if i[y] == g[y]:
						t += 1
				if t > T:
					T = t
					k = g
					u = v
		newArray.remove(k)
		result += v - T
print(result)


from typing import Counter
n = int(input())
c = [Counter() for _ in range(4)]
for i in range(n):
	s = input()
	c[len(s) - 1][s[-1]] += 1
for i in range(n):
	s = input()
	c[len(s) - 1][s[-1]] -= 1
res = 0
for i in range(4):
	res += max(0, c[i]['S']) + max(0, c[i]['M']) + max(0, c[i]['L'])
print(res)


n = int(input())
ls1 = list()
ls2 = list()
for i in range(n):
	ls1.append(input())
for i in range(n):
	ls2.append(input())
if ls1 == ls2:
	print(0)
else:
	c = 0
	for i in range(n):
		if ls2[i] not in ls1:
			c += 1
		else:
			del ls1[ls1.index(ls2[i])]
	print(c)


n = int(input())
a = [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]
b = 'SLM'
o = 0
for i in range(n):
	i = input()
	a[len(i) - 1][b.index(i[-1])] += 1
for i in range(n):
	i = input()
	o += 1
	if a[len(i) - 1][b.index(i[-1])] > 0:
		a[len(i) - 1][b.index(i[-1])] -= 1
		o -= 1
print(o)


def main():
	amount = input()
	amount = int(amount)
	base = []
	for i in range(amount):
		base.append(input())
	expected = []
	for i in range(amount):
		expected.append(input())
	transform = []
	for e in expected:
		if e not in base:
			transform.append(e)
		else:
			base.remove(e)
	result = len(transform)
	print(result)
	return len(transform)
main()


import sys
n = int(input())
d1 = {}
d2 = {}
d1['M'] = 0
d2['M'] = 0
ls = ['L', 'S']
for i in range(4):
	for ch in ls:
		d1['X' * i + ch] = 0
		d2['X' * i + ch] = 0
for i in range(n):
	temp = input()
	d1[temp] += 1
for i in range(n):
	temp = input()
	d2[temp] += 1
ans = 0
for size in d1:
	if d2[size] > d1[size]:
		ans += d2[size] - d1[size]
print(ans)


n = int(input())
sizes = {'XXXS': 0, 'XXS': 1, 'XS': 2, 'S': 3, 'M': 4, 'L': 5, 'XL': 6, 'XXL': 7, 'XXXL': 8}
last_year = [0] * 9
for i in range(n):
	last_year[sizes[input()]] += 1
for i in range(n):
	last_year[sizes[input()]] -= 1
print(sum([abs(x) for x in last_year if x < 0]))


n = int(input())
a = {}
b = {}
for i in range(n):
	s = input()
	if s not in a:
		a[s] = 0
	a[s] += 1
for i in range(n):
	s = input()
	if s not in b:
		b[s] = 0
	b[s] += 1
cnt = 0
for x in a:
	cnt += max(0, a[x] - (0 if x not in b else b[x]))
print(cnt)


t = int(input())
z = t
previous = []
current = []
a = [0] * 10
b = [0] * 10
c = [0] * 10
(count, count1, count2) = (0, 0, 0)
while t:
	r = input()
	previous.append(r)
	t -= 1
while z:
	r = input()
	current.append(r)
	z -= 1
for i in previous:
	if i == 'M':
		a[0] += 1
	if i == 'S':
		a[1] += 1
	if i == 'XS':
		a[3] += 1
	if i == 'XXS':
		a[5] += 1
	if i == 'XXXS':
		a[7] += 1
	if i == 'L':
		a[2] += 1
	if i == 'XL':
		a[4] += 1
	if i == 'XXL':
		a[6] += 1
	if i == 'XXXL':
		a[8] += 1
for i in current:
	if i == 'M':
		b[0] += 1
	if i == 'S':
		b[1] += 1
	if i == 'XS':
		b[3] += 1
	if i == 'XXS':
		b[5] += 1
	if i == 'XXXS':
		b[7] += 1
	if i == 'L':
		b[2] += 1
	if i == 'XL':
		b[4] += 1
	if i == 'XXL':
		b[6] += 1
	if i == 'XXXL':
		b[8] += 1
for i in range(9):
	c[i] = abs(a[i] - b[i])
for i in range(3):
	count1 += c[i]
count += int(count1 / 2)
(count1, count2) = (0, 0)
for i in range(3, 9):
	count1 += c[i]
count += int(count1 / 2)
print(count)


from collections import defaultdict
n = int(input())
d = defaultdict(int)
r = 0
for i in range(n):
	d[input()] += 1
for i in range(n):
	s = input()
	if d[s]:
		d[s] -= 1
	else:
		r += 1
print(r)


n = int(input())
x = ['M', 'S', 'L', 'XS', 'XXS', 'XXXS', 'XL', 'XXL', 'XXXL']
a = [0] * len(x)
b = [0] * len(x)
for i in range(n):
	a[x.index(input())] += 1
for i in range(n):
	b[x.index(input())] += 1
ans = 0
for i in range(len(a)):
	xx = min(a[i], b[i])
	a[i] -= xx
	b[i] -= xx
for i in a:
	ans += i
print(ans)


n = int(input())
a = []
b = []
ans = 0
for _ in range(n):
	s = input()
	a.append(s)
for i in range(n):
	s = input()
	if s in a:
		a.remove(s)
print(len(a))


n = int(input())
x = [input() for i in range(n)]
y = [input() for i in range(n)]
x.sort()
y.sort()
ans = 0
while x:
	if x[-1] not in y:
		ans += 1
	else:
		y.pop(y.index(x[-1]))
	x.pop()
print(ans)


num = int(input())
last = {}
change = 0
for i in range(num):
	name = input()
	if last.__contains__(name):
		last[name] += 1
	else:
		last[name] = 1
for i in range(num):
	name = input()
	if last.__contains__(name) and last[name] >= 1:
		last[name] -= 1
	else:
		change += 1
print(change)


n = int(input())
li_a = []
li_b = []
flag = 0
for i in range(n):
	li_a.append(input())
for i in range(n):
	li_b.append(input())
for i in range(n):
	if li_a[i] in li_b:
		li_b.remove(li_a[i])
	else:
		flag += 1
print(flag)


n = int(input())
arr1 = []
arr2 = []
for _ in range(n):
	arr1 += [input()]
for _ in range(n):
	arr2 += [input()]
for word in arr1:
	if word in arr2:
		arr2.remove(word)
print(len(arr2))


def check(a, b):
	if a == None or b == None:
		return 0
	count = 0
	if len(a) == len(b):
		count += 1
	elif len(b) > len(a):
		if b[len(b) - 1] != a[len(a) - 1]:
			count += 1
		count = count + len(b) - len(a)
	else:
		check(b, a)
	return count
n = int(input())
a = []
b = []
n = 2 * n
for i in range(1, n + 1):
	if i <= n // 2:
		t = str(input())
		a.append(t)
	else:
		z = str(input())
		if a.count(z) == 0:
			b.append(z)
		else:
			a.remove(z)
a.sort()
b.sort()
sum = 0
for i in range(len(a)):
	sum = sum + check(a[i], b[i])
print(sum)


dct1 = {'M': 0, 'S': 0, 'L': 0, 'XS': 0, 'XL': 0, 'XXS': 0, 'XXL': 0, 'XXXS': 0, 'XXXL': 0}
dct2 = {'M': 0, 'S': 0, 'L': 0, 'XS': 0, 'XL': 0, 'XXS': 0, 'XXL': 0, 'XXXS': 0, 'XXXL': 0}
r = int(input())
for i in range(0, r):
	s = input()
	dct1[s] += 1
for i in range(0, r):
	s = input()
	dct2[s] += 1
su = 0
for k in dct1.keys():
	if dct1[k] > dct2[k]:
		su += dct1[k] - dct2[k]
print(su)


n = int(input())
a = [input() for _ in range(n)]
b = [input() for _ in range(n)]
ans = 0
ans += abs(a.count('L') - b.count('L'))
ans += abs(a.count('M') - b.count('M'))
ans += abs(a.count('S') - b.count('S'))
ans //= 2
ans += abs(a.count('XS') - b.count('XS'))
ans += abs(a.count('XXS') - b.count('XXS'))
ans += abs(a.count('XXXS') - b.count('XXXS'))
print(ans)


n = int(input())
a = []
b = []
for i in range(n):
	a.append(input())
for i in range(n, 2 * n):
	b.append(input())
counter = 0
for i in a:
	if i in b:
		b.remove(i)
		counter += 1
print(n - counter)


n = int(input())
a = []
b = []
for i in range(n):
	x = input()
	a.append(x)
for i in range(n):
	x = input()
	if not x in a:
		b.append(x)
	if x in a:
		d = a.index(x)
		a.pop(d)
print(len(b))


import sys
import math
n = int(input())
aa = []
bb = []
for i in range(2 * n):
	ert = str(input())
	if i < n:
		aa.append(ert)
	else:
		bb.append(ert)
sa = sorted(aa)
sb = sorted(bb)
stra = ['L', 'M', 'S', 'XS', 'XL', 'XXS', 'XXL', 'XXXS', 'XXXL']
qaa = [0 for i in range(9)]
qbb = [0 for j in range(9)]
cnt = 0
for i in range(len(stra)):
	qaa[i] = sa.count(stra[i])
	qbb[i] = sb.count(stra[i])
	diff = qaa[i] - qbb[i]
	if i < 3:
		if diff > 0:
			cnt += diff
	elif i == 3 or i == 4:
		if diff > 0:
			cnt += diff
	elif i == 5 or i == 6:
		if diff > 0:
			cnt += diff
	elif i == 7 or i == 8:
		if diff > 0:
			cnt += diff
print(cnt)


n = int(input())
(a, b) = ([], [])
for i in range(n):
	x = input()
	a.append(x)
for i in range(n):
	x = input()
	if x in a:
		a.remove(x)
print(len(a))


class CodeforcesTask1000ASolution:

	def __init__(self):
		self.result = ''
		self.n = 0
		self.prev = []
		self.curr = []

	def read_input(self):
		self.n = int(input())
		for x in range(self.n):
			self.prev.append(input())
		for x in range(self.n):
			self.curr.append(input())

	def process_task(self):
		sizes = ['M', 'L', 'S', 'XL', 'XS', 'XXL', 'XXS', 'XXXL', 'XXXS']
		from_s = [self.prev.count(x) for x in sizes]
		to_s = [self.curr.count(x) for x in sizes]
		needed = [abs(to_s[x] - from_s[x]) for x in range(len(sizes))]
		c = sum(needed[:3]) // 2 + needed[3] + needed[5] + needed[7]
		self.result = str(c)

	def get_result(self):
		return self.result
Solution = CodeforcesTask1000ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


n = int(input())
num = []
for i in range(n):
	s = input()
	num.append(s)
num2 = []
for i in range(n):
	s = input()
	num2.append(s)
i = 0
ans = 0
while i < len(num):
	if num[i] in num2:
		num2.pop(num2.index(num[i]))
		num.pop(i)
	else:
		i += 1
while len(num):
	x = num[0]
	if True:
		best = -1
		min_el = 10000
		for i in range(len(num2)):
			if len(num2[i]) == len(x):
				ans += 1
				num2.pop(i)
				num.pop(0)
				break
print(ans)


n = int(input())
a = []
b = []
for i in range(n):
	a.append(input())
for i in range(n):
	b.append(input())
answer = 0
for i in range(n):
	if b[i] not in a:
		answer += 1
	else:
		a[a.index(b[i])] = ''
print(answer)


import sys, math
n = int(input())
(ls1, ls2) = ([], [])
for i in range(n):
	s = input()
	ls1.append(s)
for i in range(n):
	s = input()
	ls2.append(s)
c = 0
for i in range(n):
	if ls1[i] in ls2:
		c += 1
		ls2[ls2.index(ls1[i])] = None
print(n - c)


n = int(input())
(list_pre, list_cur) = ([], [])
for i in range(n):
	list_pre.append(input())
for i in range(n):
	list_cur.append(input())
for i in range(n):
	size_pre = list_pre[i]
	for i in range(n):
		if size_pre == list_cur[i]:
			list_cur[i] = 0
			break
count = 0
for i in range(n):
	if list_cur[i] == 0:
		count += 1
print(n - count)


import os
import sys
import math
n = int(input())
c = list()
d = list()
for x in range(0, n):
	c.append(str(input()))
for x in range(0, n):
	d.append(str(input()))
ans = 0
for i in range(0, len(c)):
	if c[i] not in d:
		ans += 1
	elif c[i] in d:
		d.remove(c[i])
print(ans)


from sys import stdin, stdout

def rint():
	return map(int, stdin.readline().split())
n = int(input())
pt = [[] for i in range(4)]
for i in range(n):
	tmp = input()
	pt[len(tmp) - 1].append(tmp[-1])
ct = [[] for i in range(4)]
for i in range(n):
	tmp = input()
	ct[len(tmp) - 1].append(tmp[-1])
cnt = 0
for i in range(4):
	pt[i].sort()
	ct[i].sort()
	if i == 0:
		cnt += (abs(pt[i].count('M') - ct[i].count('M')) + abs(pt[i].count('S') - ct[i].count('S')) + abs(pt[i].count('L') - ct[i].count('L'))) // 2
	else:
		cnt += abs(pt[i].count('S') - ct[i].count('S'))
print(cnt)


(l1, l2) = ([], [])
n = int(input())
for _ in range(n):
	s = input()
	l1.append(s)
for _ in range(n):
	s = input()
	l2.append(s)
temp = ['L', 'M', 'S']
for i in range(1, 4):
	f = 'X' * i
	x = f + 'S'
	y = f + 'L'
	temp.append(x)
	temp.append(y)
(d1, d2) = ({}, {})
for i in temp:
	d1.update({i: 0})
	d2.update({i: 0})
for i in l1:
	d1[i] += 1
for i in l2:
	d2[i] += 1
c = 0
for i in temp:
	c = c + abs(d1[i] - d2[i])
print(c // 2)


(prev, curr) = ([], [])
t = int(input())
for i in range(t):
	prev.append(input())
for i in range(t):
	curr.append(input())
prev = sorted(prev)
curr = sorted(curr)
rem = []
for i in prev:
	if i in curr:
		rem.append(i)
for i in rem:
	if i in prev and i in curr:
		prev.remove(i)
		curr.remove(i)
if curr == [] and prev == []:
	print(0)
else:
	print(len(prev))


from collections import Counter
n = int(input())
a = []
for i in range(n):
	a.append(input().strip())
b = []
for i in range(n):
	cur = input().strip()
	try:
		cur_ind = a.index(cur)
		a.pop(cur_ind)
	except:
		b.append(cur)
print(len(a))


x = int(input())
list1 = []
for i in range(x):
	value = input()
	list1.append(value)
for i in range(x):
	value = input()
	if value in list1:
		list1.remove(value)
print(len(list1))


n = int(input())
lst1 = []
for i in range(n):
	lst1.append(input())
lst2 = []
for i in range(n):
	lst2.append(input())
lst1.sort()
lst2.sort()
for i in range(n):
	if lst1[i] in lst2:
		lst2.remove(lst1[i])
print(len(lst2))


n = int(input())
prev_yr = []
cur_yr = []
for i in range(n):
	prev_yr.append(input())
for i in range(n):
	cur_yr.append(input())
for i in range(len(prev_yr)):
	if prev_yr[i] in cur_yr:
		cur_yr.pop(cur_yr.index(prev_yr[i]))
print(len(cur_yr))


n = int(input())
last = []
current = []
for i in range(n):
	temp = input()
	last.append(temp)
for i in range(n):
	temp = input()
	if temp in last:
		last.remove(temp)
	else:
		current.append(temp)
print(len(current))


n = int(input())
a = []
for i in range(n):
	a.append(input())
count = 0
for i in range(n):
	s = input()
	if s in a:
		a.remove(s)
	else:
		count += 1
print(count)


n = int(input())
A = []
for i in range(n):
	A.append(input())
B = []
for i in range(n):
	B.append(input())
for (i, p) in enumerate(A):
	for (j, q) in enumerate(B):
		if p == q:
			A[i] = '00000'
			B[j] = '00000'
			break
cnt = 0
for i in A:
	if i != '00000':
		cnt += 1
print(cnt)


import sys
from collections import Counter

def main():
	n = int(sys.stdin.readline())
	a = [sys.stdin.readline().strip() for _ in range(n)]
	b = [sys.stdin.readline().strip() for _ in range(n)]
	res = 0
	for e in a:
		if e in b:
			b.remove(e)
		else:
			res += 1
	print(res)
main()


n = int(input())
A = [input() for _ in range(n)]
B = [input() for _ in range(n)]
for i in ['M', 'S', 'XS', 'XXS', 'XXXS', 'L', 'XL', 'XXL', 'XXXL']:
	while i in A and i in B:
		del A[A.index(i)]
		del B[B.index(i)]
print(len(A))


dict1 = {}
count = 0
x = int(input())
f = [input() for i in range(x)]
g = [input() for j in range(x)]
for i in f:
	if i in g:
		g.remove(i)
print(len(g))


A = [[0 for _ in range(len('SML'))] for _ in range(4 + 1)]
B = [[0 for _ in range(len('SML'))] for _ in range(4 + 1)]
n = int(input())
MM = {'S': 0, 'M': 1, 'L': 2}
for _ in range(n):
	tmp = input()
	A[len(tmp)][MM[tmp[-1]]] += 1
for _ in range(n):
	tmp = input()
	B[len(tmp)][MM[tmp[-1]]] += 1
result = 0
for i in range(len(A)):
	for j in range(len(A[i])):
		result += max([0, A[i][j] - B[i][j]])
print(result)


n = int(input())
cnt = {}
for i in range(n):
	ls = input()
	if ls in cnt:
		cnt[ls] = cnt[ls] + 1
	else:
		cnt[ls] = 1
ans = n
for i in range(n):
	ls = input()
	if ls in cnt and cnt[ls] >= 1:
		cnt[ls] = cnt[ls] - 1
		ans = ans - 1
print(ans)


n = int(input())
prevsp = []
newsp = []
am = 0
for i in range(n):
	prevsp.append(input())
for i in range(n):
	newsp.append(input())
for i in range(n):
	try:
		t = prevsp.index(newsp[i])
		if t != -1:
			prevsp.pop(t)
			am += 1
	except Exception:
		continue
print(n - am)


prev = {'XXXS': 0, 'XXS': 0, 'XS': 0, 'S': 0, 'M': 0, 'L': 0, 'XL': 0, 'XXL': 0, 'XXXL': 0}
curr = {'XXXS': 0, 'XXS': 0, 'XS': 0, 'S': 0, 'M': 0, 'L': 0, 'XL': 0, 'XXL': 0, 'XXXL': 0}
n = int(input())
for i in range(n):
	val = input()
	prev[val] += 1
for i in range(n):
	val = input()
	curr[val] += 1
diff = 0
for i in prev.keys():
	diff += abs(prev[i] - curr[i])
print(diff // 2)


n = int(input())
l1 = []
for i in range(n):
	l1.append(input())
l2 = []
for i in range(n):
	l2.append(input())
for i in l1:
	if i in l2:
		l2.remove(i)
print(len(l2))


n = int(input())
d = {}
for i in range(n):
	data = input()
	l = len(data)
	if not l in d:
		d[l] = {}
	for j in data:
		if not j in d[l]:
			d[l][j] = 0
		d[l][j] += 1
for i in range(n):
	data = input()
	l = len(data)
	if not l in d:
		d[l] = {}
	for j in data:
		if not j in d[l]:
			d[l][j] = 0
		d[l][j] -= 1
ans = 0
for i in d:
	for j in d[i]:
		if d[i][j] > 0:
			ans += d[i][j]
print(ans)


n = int(input())
old = [input() for i in range(n)]
count = 0
for i in range(n):
	try:
		old.remove(input())
	except:
		count += 1
print(count)


n = int(input())
L = 0
M = 0
S = 0
XS = 0
XL = 0
XXL = 0
XXS = 0
XXXL = 0
XXXS = 0

def Counter(s, L, S, M, XS, XL, XXS, XXL, XXXS, XXXL):
	if s == 'L':
		L += 1
	elif s == 'S':
		S += 1
	elif s == 'M':
		M += 1
	elif s == 'XS':
		XS += 1
	elif s == 'XL':
		XL += 1
	elif s == 'XXS':
		XXS += 1
	elif s == 'XXL':
		XXL += 1
	elif s == 'XXXS':
		XXXS += 1
	elif s == 'XXXL':
		XXXL += 1
	return (L, S, M, XS, XL, XXS, XXL, XXXS, XXXL)
for i in range(n):
	(L, S, M, XS, XL, XXS, XXL, XXXS, XXXL) = Counter(input(), L, S, M, XS, XL, XXS, XXL, XXXS, XXXL)
_L = 0
_M = 0
_S = 0
_XS = 0
_XL = 0
_XXL = 0
_XXS = 0
_XXXL = 0
_XXXS = 0
for i in range(n):
	(_L, _S, _M, _XS, _XL, _XXS, _XXL, _XXXS, _XXXL) = Counter(input(), _L, _S, _M, _XS, _XL, _XXS, _XXL, _XXXS, _XXXL)
res = abs(S - _S) + abs(L - _L) + abs(M - _M) + abs(XS - _XS) + abs(XL - _XL) + abs(XXS - _XXS) + abs(XXL - _XXL) + abs(XXXS - _XXXS) + abs(XXXL - _XXXL)
print(res // 2)


n = int(input())
l1 = []
l2 = []
for _ in range(n):
	l1.append(input())
for _ in range(n):
	l2.append(input())
c = 0
for i in range(n):
	if l1[i] in l2:
		l2.remove(l1[i])
	else:
		c += 1
print(c)


n = int(input())
moves = 0
T_shorts_old = {'M': 0, 'S': 0, 'L': 0, 'XS': 0, 'XL': 0, 'XXS': 0, 'XXL': 0, 'XXXS': 0, 'XXXL': 0}
T_shorts_new = {'M': 0, 'S': 0, 'L': 0, 'XS': 0, 'XL': 0, 'XXS': 0, 'XXL': 0, 'XXXS': 0, 'XXXL': 0}
for i in range(n):
	T_shorts_old[str(input())] += 1
for i in range(n):
	T_shorts_new[str(input())] += 1
for i in range(9):
	moves += abs(T_shorts_new[tuple(T_shorts_new)[i]] - T_shorts_old[tuple(T_shorts_new)[i]])
moves *= 0.5
print(int(moves))


n = int(input())
(orig, new) = ([], [])
for i in range(n):
	orig.append(input())
for i in range(n):
	new.append(input())
cp = orig[:]
for tee in cp:
	if tee in new:
		orig.remove(tee)
		new.remove(tee)
orig.sort()
new.sort()
count = 0
for i in range(len(orig)):
	if orig[i] != new[i]:
		count += 1
print(count)


from collections import defaultdict
n = int(input())
(A, B) = (defaultdict(int), defaultdict(int))
for L in (A, B):
	for i in range(n):
		L[input().strip()] += 1
answer = n
sizes1let = ('L', 'M', 'S')
answer -= sum([min(A[size], B[size]) for size in sizes1let])
sizes2let = ('L', 'S')
for x in ('X', 'XX', 'XXX'):
	sizes = [x + s for s in sizes2let]
	answer -= sum([min(A[size], B[size]) for size in sizes])
print(answer)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans
n = int(input())
li1 = [[], [], [], []]
li2 = [[], [], [], []]
cnt = 0
for _ in range(n):
	tshirt = input()
	li1[len(tshirt) - 1].append(tshirt)
for _ in range(n):
	tshirt = input()
	li2[len(tshirt) - 1].append(tshirt)
for i in range(4):
	for j in range(len(li2[i])):
		if li2[i][j] in li1[i]:
			li1[i].remove(li2[i][j])
	cnt += len(li1[i])
print(cnt)


n = int(input())
aa = [input() for i in range(n)]
bb = [input() for i in range(n)]
res = 0
for size in ['XL', 'XXL', 'XXXL']:
	c1 = aa.count(size)
	c2 = bb.count(size)
	res += abs(c1 - c2)
temp = 0
for size in 'MLS':
	temp = max(temp, abs(aa.count(size) - bb.count(size)))
res += temp
print(res)


size = int(input())
list = []
for a in range(size):
	m = input()
	list.append(m)
for a in range(size):
	m = input()
	if m in list:
		list.remove(m)
print(len(list))


n = int(input())
sizeDict = {'XXXS': 0, 'XXS': 0, 'XS': 0, 'S': 0, 'M': 0, 'L': 0, 'XL': 0, 'XXL': 0, 'XXXL': 0}
for i in range(n):
	sizeDict[input()] += 1
count = 0
for i in range(n):
	current = input()
	if sizeDict[current]:
		sizeDict[current] -= 1
	else:
		count += 1
print(count)


N = int(input())
a = [input().strip() for i in range(N)]
c = [input().strip() for i in range(N)]
a = sorted(a)
c = sorted(c)
ans = 0
sabu = (abs(a.count('L') - c.count('L')) + abs(a.count('S') - c.count('S')) + abs(a.count('M') - c.count('M'))) / 2
ans += int(sabu)
tann = a.count('L') + a.count('M') + a.count('S')
for i in range(tann, N):
	if a[i] != c[i]:
		ans += 1
print(ans)


n = int(input())
pyear = []
for i in range(n):
	pyear.append(input())
year = []
for i in range(n):
	year.append(input())
counter = 0
for x in pyear:
	if x in year:
		year.remove(x)
		counter += 1
print(n - counter)


n = int(input())
a = []
b = []
d = 0
for i in range(n):
	a.append(input())
for i in range(n):
	b.append(input())
for i in range(n):
	if not a[i] in b:
		d += 1
	else:
		for j in range(n):
			if b[j] == a[i]:
				b.remove(b[j])
				break
print(d)


from collections import defaultdict
n = int(input())
prev = defaultdict(lambda : 0, {})
now = []
for i in range(n):
	ele = input()
	prev[ele] += 1
for i in range(n):
	ele = input()
	if prev[ele] > 0:
		prev[ele] -= 1
	elif prev[ele] == 0:
		now.append(ele)
prev1 = []
for ele in prev:
	if prev[ele] > 0:
		prev1.append(ele)
l1 = len(prev1)
l2 = len(now)
print(l2)


n = int(input())
a = []
count = 0
for i in range(n):
	a.append(input())
for i in range(n):
	try:
		a.remove(input())
	except:
		count += 1
print(count)


n = int(input())
m = {}
a = []
b = []
m = 0
for _ in range(n):
	a.append(input())
for _ in range(n):
	b.append(input())
ans = 0
for i in range(n):
	m = 0
	for j in range(n):
		if b[i] == a[j]:
			a[j] = 5
			m = 1
			break
	if m == 0:
		ans += 1
print(ans)


A = []
B = []
N = int(input())
for i in range(N):
	A.append(input())
for i in range(N):
	B.append(input())
ans = 0
for i in B:
	if i in A:
		x = A.index(i)
		A = A[:x] + A[x + 1:]
	else:
		ans += 1
print(ans)


n = int(input())
a = []
b = []
for i in range(n):
	a.append(input())
for i in range(n):
	b.append(input())
used1 = [0] * n
used2 = [0] * n
c = [1] * n
d = [1] * n
for i in range(n):
	for j in range(n):
		if a[i] == b[j] and used1[i] == 0 and (used2[j] == 0):
			used1[i] = 1
			used2[j] = 1
for i in range(n):
	c[i] = len(a[i])
	d[i] = len(b[i])
s = 0
for i in range(n):
	for j in range(n):
		if used1[i] == 0 and used2[j] == 0:
			if c[i] == d[j]:
				used1[i] = 1
				used2[j] = 1
				s += 1
print(s)


n = 0
t1 = {}
t2 = {}
k = 0
flag = False
n = int(input())
for i in range(n):
	s = input()
	if len(s) not in t1.keys():
		t1[len(s)] = [s]
	else:
		t1[len(s)].append(s)
for i in range(n):
	s = input()
	lst = []
	for lst in t1.values():
		if s in lst:
			t1[len(s)].pop(t1[len(s)].index(s))
			flag = True
			break
	if flag == True:
		flag = False
		continue
	if len(s) not in t2.keys():
		t2[len(s)] = [s]
	else:
		t2[len(s)].append(s)
lst = []
for lst in t1.values():
	k += len(lst)
print(k)


n = int(input())
previous = []
for i in range(n):
	previous.append(input())
current = []
for i in range(n):
	current.append(input())
	if previous.count(current[-1]) > 0:
		del previous[previous.index(current[-1])]
		del current[-1]
previous.sort()
current.sort()
ans = 0
for i in range(len(previous)):
	for j in range(len(previous[i])):
		if previous[i][j] != current[i][j]:
			ans += 1
print(ans)


def can_change(a, b):
	return a.replace('S', '') + 'L' == b or a.replace('S', '') + 'M' == b or a.replace('M', '') + 'S' == b or (a.replace('M', '') + 'L' == b) or (a.replace('L', '') + 'S' == b) or (a.replace('L', '') + 'M' == b)
n = int(input())
lia = []
lib = []
for i in range(2 * n):
	if i >= n:
		b = input()
		lib.append(b)
	else:
		a = input()
		lia.append(a)
w = [i for i in range(n)]
flag = dict.fromkeys(w, 0)
ans = 0
for i in range(len(lib)):
	x = False
	for j in range(len(lia)):
		if lib[i] == lia[j] and flag[j] == 0:
			flag[j] = 1
			x = True
			break
	if not x:
		xx = False
		for j in range(len(lia)):
			if can_change(lia[j], lib[i]) and flag[j] == 0:
				xx = True
				ans += 1
				flag[j] == 1
				break
		if not xx:
			ans += 1
print(ans)


import collections
t = int(input())
a1 = []
for i in range(t):
	a1.append(input())
a2 = []
for i in range(t):
	a2.append(input())
d1 = collections.Counter(a1)
d2 = collections.Counter(a2)
if d1 == d2:
	print(0)
else:
	c = 0
	p1 = {}
	p2 = {}
	for i in range(1, 5):
		p1[i] = []
		p2[i] = []
	for i in a1:
		p1[len(i)].append(i[-1])
	for i in a2:
		p2[len(i)].append(i[-1])
	for i in range(1, 5):
		k1 = p1[i]
		k2 = p2[i]
		l1 = k1.count('L')
		s1 = k1.count('S')
		m1 = k1.count('M')
		l2 = k2.count('L')
		s2 = k2.count('S')
		m2 = k2.count('M')
		ar1 = [abs(l1 - l2), abs(s1 - s2), abs(m1 - m2)]
		mm = max(ar1)
		c += mm
	print(c)


def totalTime(prev_year, curr_year):
	for i in curr_year:
		if i in prev_year:
			prev_year.remove(i)
	return len(prev_year)
size = int(input())
prev_year = [input() for _ in range(size)]
curr_year = [input() for _ in range(size)]
print(totalTime(prev_year, curr_year))


n = int(input())
a = []
b = []
for i in range(n):
	a.append(input())
for i in range(n):
	b.append(input())
c = 0
vis = [0 for x in range(n)]
for i in range(n):
	for j in range(n):
		if vis[j] == 0 and a[i] == b[j]:
			vis[j] = 1
			c += 1
			break
print(n - c)


def main():
	n = int(input())
	a = [input() for i in range(n)]
	b = [input() for i in range(n)]
	dct = {'M': 0, 'XXXL': 0, 'XXXS': 0, 'XXS': 0, 'XXL': 0, 'XL': 0, 'XS': 0, 'S': 0, 'L': 0}
	dct2 = {'M': 0, 'XXXL': 0, 'XXXS': 0, 'XXS': 0, 'XXL': 0, 'XL': 0, 'XS': 0, 'S': 0, 'L': 0}
	for i in range(n):
		dct[a[i]] += 1
		dct2[b[i]] += 1
	ret = 0
	for i in dct:
		ret += abs(dct[i] - dct2[i])
	ret = ret // 2
	print(ret)
	return 0
main()


n = int(input())
(a, b) = ([], [])
for i in range(n):
	a.append(input())
for i in range(n):
	b.append(input())
C = ['S', 'M', 'L', 'XL', 'XXL', 'XXXL', 'XS', 'XXS', 'XXXS']
d = []
for s in C:
	if a.count(s) - b.count(s) < 0:
		d.append(-(a.count(s) - b.count(s)))
print(sum(d))


n = int(input())
last_year = []
this_year = []
result = 0
for i in range(n):
	last_year.append(input())
for i in range(n):
	text = input()
	for j in range(last_year.__len__() - 1, -1, -1):
		if last_year[j] == text:
			last_year.pop(j)
			break
		elif j == 0:
			this_year.append(text)
for i in range(this_year.__len__() - 1, -1, -1):
	temp_result = 4
	index_this = -1
	index_last = -1
	for j in range(last_year.__len__() - 1, -1, -1):
		if this_year[i].__len__() == last_year[j].__len__():
			x = 0
			for k in range(this_year[i].__len__()):
				if this_year[i][k] != last_year[j][k]:
					x += 1
			if x < temp_result:
				temp_result = x
				index_this = i
				index_last = j
	this_year.pop(index_this)
	last_year.pop(index_last)
	result += temp_result
print(result)


n = int(input())
a1 = []
a2 = []
for _ in range(n):
	s = input()
	a1.append(s)
for _ in range(n):
	s = input()
	a2.append(s)
k = 0
for x in a1:
	if x in a2:
		k += 1
		a2.pop(a2.index(x))
print(len(a1) - k)


from collections import Counter
n = int(input())
cont = Counter()
cont2 = Counter()
for i in range(n):
	string = input()
	cont[string] += 1
for i in range(n):
	string = input()
	cont2[string] += 1
cont2.subtract(cont)
sums = 0
for i in cont2.items():
	sums += abs(i[1])
print(sums // 2)


n = int(input())
a = [input() for _ in range(n)]
b = [input() for _ in range(n)]
res = 0
for i in a:
	if i not in b:
		res += 1
	else:
		del b[b.index(i)]
print(res)


n = int(input())
(a, b) = ([], [])
for _ in range(n):
	a.append(input())
for _ in range(n):
	b.append(input())
ans = []
for i in b:
	if i not in a:
		ans.append(i)
	else:
		a[a.index(i)] = ''
print(len(ans))


import sys
input = sys.stdin.readline
(a, n, ans) = ({}, int(input()), 0)
for i in range(n):
	s = input()
	if s in a.keys():
		a[s] = a[s] + 1
	else:
		a[s] = 1
for i in range(n):
	s = input()
	if s in a.keys():
		if a[s] > 0:
			a[s] = a[s] - 1
		else:
			ans += 1
	else:
		ans += 1
print(ans)


from collections import Counter
k = int(input())
a = []
b = []
for i in range(k):
	a.append(input())
for j in range(k):
	b.append(input())
a = Counter(a)
b = Counter(b)
no = 0
for c in b:
	if c in a:
		no += max(b[c] - a[c], 0)
	else:
		no += b[c]
print(no)


from sys import stdin, stdout
from math import gcd, ceil, sqrt
from itertools import combinations
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
n = ii1()
prev = []
for i in range(n):
	prev.append(is1())
cur = []
for i in range(n):
	cur.append(is1())
if sorted(prev) == sorted(cur):
	print(0)
else:
	res = 0
	for i in prev:
		for j in range(len(cur)):
			if i == cur[j]:
				cur.pop(j)
				res += 1
				break
	print(n - res)


a = int(input())
(z, z1) = ([], [])
for i in range(2 * a):
	if i < a:
		z += [input()]
	else:
		z1 += [input()]
r = z.copy()
for i in range(a):
	if z[i] in z1:
		r.remove(z[i])
		z1.remove(z[i])
r = sorted(r)
z1 = sorted(z1)
s = 0
for i in range(len(r)):
	for j in range(len(r[i])):
		s += r[i][j] != z1[i][j]
print(s)


n = int(input())
old = [input() for _ in range(n)]
new = [input() for _ in range(n)]
cnt = 0
for i in old:
	if i in new:
		new.remove(i)
		cnt += 1
print(n - cnt)


n = int(input())
a = {'S': 0, 'XS': 0, 'XXS': 0, 'XXXS': 0, 'M': 0, 'L': 0, 'XL': 0, 'XXL': 0, 'XXXL': 0}
b = {'S': 0, 'XS': 0, 'XXS': 0, 'XXXS': 0, 'M': 0, 'L': 0, 'XL': 0, 'XXL': 0, 'XXXL': 0}
for i in range(n):
	s = str(input())
	a[s] += 1
for i in range(n):
	s = str(input())
	b[s] += 1
result = 0
result += abs(a['XL'] - b['XL'])
result += abs(a['XXL'] - b['XXL'])
result += abs(a['XXXL'] - b['XXXL'])
result += max(abs(a['L'] - b['L']), abs(a['M'] - b['M']), abs(a['S'] - b['S']))
print(result)


n = int(input())
a = [input() for _ in range(n)]
for _ in range(n):
	x = input()
	if x in a:
		a.remove(x)
		n -= 1
print(n)


n = int(input())
a = []
b = []
for i in range(0, n):
	a.append(str(input()))
for i in range(0, n):
	b.append(str(input()))
c = 0
for i in range(0, n):
	if a[i] in b:
		b.pop(b.index(a[i]))
		c = c + 1
print(len(a) - c)


n = int(input())
prev = []
for _ in range(n):
	prev.append(input().strip())
current = []
for _ in range(n):
	current.append(input().strip())
prev_counts = [0] * 9
for s in prev:
	if s == 'S':
		prev_counts[0] += 1
	elif s == 'M':
		prev_counts[1] += 1
	elif s == 'L':
		prev_counts[2] += 1
	elif s == 'XS':
		prev_counts[3] += 1
	elif s == 'XXS':
		prev_counts[4] += 1
	elif s == 'XXXS':
		prev_counts[5] += 1
	elif s == 'XL':
		prev_counts[6] += 1
	elif s == 'XXL':
		prev_counts[7] += 1
	elif s == 'XXXL':
		prev_counts[8] += 1
curr_counts = [0] * 9
for s in current:
	if s == 'S':
		curr_counts[0] += 1
	elif s == 'M':
		curr_counts[1] += 1
	elif s == 'L':
		curr_counts[2] += 1
	elif s == 'XS':
		curr_counts[3] += 1
	elif s == 'XXS':
		curr_counts[4] += 1
	elif s == 'XXXS':
		curr_counts[5] += 1
	elif s == 'XL':
		curr_counts[6] += 1
	elif s == 'XXL':
		curr_counts[7] += 1
	elif s == 'XXXL':
		curr_counts[8] += 1
seconds = 0
diff1 = prev_counts[0] - curr_counts[0]
diff2 = prev_counts[1] - curr_counts[1]
diff3 = prev_counts[2] - curr_counts[2]
seconds += max(abs(diff1), abs(diff2), abs(diff3))
seconds += abs(prev_counts[3] - curr_counts[3])
seconds += abs(prev_counts[4] - curr_counts[4])
seconds += abs(prev_counts[5] - curr_counts[5])
print(seconds)


sizes = {'XXXS': 0, 'XXS': 1, 'XS': 2, 'S': 3, 'M': 4, 'L': 5, 'XL': 6, 'XXL': 7, 'XXXL': 8}
data_old = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0}
data_new = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0}
n = int(input())
res = 0
for _ in range(n):
	data_old[sizes[input()]] += 1
for _ in range(n):
	data_new[sizes[input()]] += 1
steps = {0: 8, 8: 0, 1: 7, 7: 1, 2: 6, 6: 2, 3: [4, 5], 4: [3, 5], 5: [3, 4]}
for i in list(data_old.keys()):
	if data_old[i] > data_new[i]:
		res += data_old[i] - data_new[i]
print(res)


n = int(input())
a = 0
coun = 0
li1 = []
li2 = []
li3 = []
for i in range(1, 2 * n + 1):
	if i <= n:
		inp = input()
		if len(inp) == 1:
			li1.append(inp)
		elif len(inp) != 1:
			li2.append(inp)
	elif i > n:
		inp = input()
		leng = len(inp)
		if leng == 1 and inp in li1:
			a = 0
			b = li1.index(inp)
			li1[b] = ''
		elif leng == 1 and inp not in li1:
			coun += 1
		elif leng != 1 and inp in li2:
			a = 0
			b = li2.index(inp)
			li2[b] = ''
		elif leng != 1 and inp not in li2:
			coun += 1
print(coun)


n = int(input())
(a, b) = ({}, {})
for i in range(0, n):
	s = input()
	a[s] = a[s] + 1 if s in a else 1
for i in range(0, n):
	s = input()
	b[s] = b[s] + 1 if s in b else 1
ans = 0
for t in ['M', 'S', 'L', 'XS', 'XL', 'XXS', 'XXL', 'XXXS', 'XXXL']:
	x = a[t] if t in a else 0
	y = b[t] if t in b else 0
	ans += abs(x - y)
print(ans // 2)


def main():
	n = int(input())
	a = []
	b = []
	for i in range(n):
		a.append(input())
	a.sort()
	ans = 0
	for i in range(n):
		t = input()
		if t in a:
			a[a.index(t)] = ''
	print(sum([1 for i in a if i != '']))
main()


n = int(input())
l = []
l2 = []
for i in range(0, n):
	l.append(input())
for j in range(0, n):
	l2.append(input())
for i in range(0, n):
	if l[i] in l2:
		l2.remove(l[i])
print(len(l2))


def solve(N, A, B):
	ad = {'XXXS': 0, 'XXS': 0, 'XS': 0, 'S': 0, 'M': 0, 'L': 0, 'XL': 0, 'XXL': 0, 'XXXL': 0}
	bd = dict(ad)
	for a in A:
		ad[a] += 1
	for b in B:
		bd[b] += 1
	ans = 0
	for k in ad:
		c = min(ad[k], bd[k])
		ans += ad[k] - c
	return ans

def main():
	N = int(input())
	A = [input() for _ in range(N)]
	B = [input() for _ in range(N)]
	print(solve(N, A, B))
main()


n = int(input())
l = []
l1 = []
for i in range(n):
	l.append(input())
for i in range(n):
	l1.append(input())
count = 0
for i in l1:
	if i in l:
		l.remove(i)
	else:
		count = count + 1
print(count)


n = int(input())
prev = []
new = []
count = 0
for a in range(n):
	a = input()
	prev.append(a)
for b in range(n):
	b = input()
	new.append(b)
while new != []:
	if new[0] in prev:
		prev.remove(new[0])
		new.remove(new[0])
	else:
		new.remove(new[0])
		count += 1
print(count)


n = int(input())
l = []
m = []
ans = 0
for _ in range(n):
	l.append(input())
for _ in range(n):
	s = input()
	if s in l:
		l.remove(s)
print(len(l))


n = int(input())
a = []
b = []
for i in range(n):
	a.append(input())
for i in range(n):
	b.append(input())
counter = 0
for i in range(n):
	if a[i] not in b:
		counter += 1
	else:
		b.remove(a[i])
print(counter)


n = int(input())
sizes = ['M', 'XL', 'XS', 'XXL', 'XXS', 'XXXL', 'XXXS', 'L', 'S']

def find(ai):
	for i in range(9):
		if sizes[i] == ai:
			return i
	return -1
s2 = [0] * 9
for i in range(n):
	ai = input()
	s2[find(ai)] += 1
for i in range(n):
	bi = input()
	s2[find(bi)] -= 1
ans = 0
for i in range(9):
	ans += abs(s2[i])
print(ans // 2)


n = int(input())
a = [input().rstrip() for _ in range(n)]
b = [input().rstrip() for _ in range(n)]
lenga = [[0, 0, 0] for _ in range(4)]
lengb = [[0, 0, 0] for _ in range(4)]
for i in range(n):
	t = 0
	if 'M' in a[i]:
		t = 1
	elif 'L' in a[i]:
		t = 2
	lenga[len(a[i]) - 1][t] += 1
	s = 0
	if 'M' in b[i]:
		s = 1
	elif 'L' in b[i]:
		s = 2
	lengb[len(b[i]) - 1][s] += 1
count = 0
for j in range(4):
	tmp = 0
	for k in range(3):
		tmp = max(tmp, abs(lenga[j][k] - lengb[j][k]))
	count += tmp
print(count)


n = int(input())
(a, b) = ([], [])
for i in range(n):
	a.append(input())
for i in range(n):
	b.append(input())
for s in b.copy():
	if s in a:
		a.remove(s)
		b.remove(s)

def count_corrections(a, b):
	s = 0
	for i in range(len(a)):
		s += int(a[i] != b[i])
	return s
if len(a) == 0:
	print(0)
	exit(0)
ans = 0
for t in range(min([len(s) for s in a]), max([len(s) for s in a]) + 1):
	x = [s for s in a if len(s) == t]
	y = [s for s in b if len(s) == t]
	x.sort()
	y.sort()
	for i in range(len(x)):
		ans += count_corrections(x[i], y[i])
print(ans)


n = int(input())
l = []
for i in range(n):
	l += [input()]
nl = []
for i in range(n):
	nl += [input()]
count = {i: 0 for i in l}
count2 = {i: 0 for i in nl}
for i in l:
	count[i] += 1
for i in nl:
	count2[i] += 1
kl = []
cnt = 0
for i in nl:
	if i in l and i not in kl:
		cnt += min(count[i], count2[i])
		kl += [i]
print(n - cnt)


i = int(input().strip())
qi = [[], [], [], []]
qo = [[], [], [], []]
for j in range(i):
	q = list(input().strip())
	qi[len(q) - 1].append(q[len(q) - 1])
for j in range(i):
	q = list(input().strip())
	qo[len(q) - 1].append(q[len(q) - 1])
for j in range(4):
	for q in qi[j]:
		if q in qo[j]:
			del qo[j][qo[j].index(q)]
print(len(qo[0]) + len(qo[1]) + len(qo[2]) + len(qo[3]))


n = int(input())
a = list()
val1 = {'M': 0, 'S': 0, 'L': 0, 'XS': 0, 'XL': 0, 'XXS': 0, 'XXL': 0, 'XXXS': 0, 'XXXL': 0}
for i in range(0, n):
	a.append(input())
	val1[a[i]] += 1
b = list()
val2 = {'M': 0, 'S': 0, 'L': 0, 'XS': 0, 'XL': 0, 'XXS': 0, 'XXL': 0, 'XXXS': 0, 'XXXL': 0}
for i in range(0, n):
	b.append(input())
	val2[b[i]] += 1
c = 0
c = c + max(abs(val1['M'] - val2['M']), abs(val1['L'] - val2['L']), abs(val1['S'] - val2['S']))
c = c + max(abs(val1['XS'] - val2['XS']), abs(val1['XL'] - val2['XL']))
c = c + max(abs(val1['XXS'] - val2['XXS']), abs(val1['XXL'] - val2['XXL']))
c = c + max(abs(val1['XXXS'] - val2['XXXS']), abs(val1['XXXL'] - val2['XXXL']))
print(c)


def call(x, y):
	n = len(x)
	i = 0
	while i < len(x):
		j = 0
		flag = 0
		while j < len(y):
			if x[i] == y[j]:
				x.pop(i)
				y.pop(j)
				flag = 1
				break
			else:
				j = j + 1
		if flag == 0:
			i = i + 1
	return len(x)

def main():
	n = input()
	n = int(n)
	d = dict()
	d['S'] = 0
	d['M'] = 1
	d['L'] = 2
	d['XS'] = 3
	d['XL'] = 4
	d['XXS'] = 5
	d['XXL'] = 6
	d['XXXS'] = 7
	d['XXXL'] = 8
	a = []
	b = []
	for i in range(0, n):
		a.append(d[input()])
	for i in range(0, n):
		b.append(d[input()])
	a.sort()
	b.sort()
	c1 = [i for i in a if 0 <= i < 3]
	c2 = [i for i in b if 0 <= i < 3]
	d1 = [i for i in a if 3 <= i < 5]
	d2 = [i for i in b if 3 <= i < 5]
	e1 = [i for i in a if 5 <= i < 7]
	e2 = [i for i in b if 5 <= i < 7]
	f1 = [i for i in a if 7 <= i < 9]
	f2 = [i for i in b if 7 <= i < 9]
	l1 = 0
	if len(c1) == len(c2) and len(d1) == len(d2) and (len(e1) == len(e2)) and (len(f1) == len(f2)):
		l1 = call(c1, c2) + call(d1, d2) + call(e1, e2) + call(f1, f2)
		print(l1)
	else:
		print(0)
main()


n = int(input())
A = []
B = []
ans = 0
for i in range(n):
	A.append(input())
for i in range(n):
	st = input()
	if st in A:
		A.remove(st)
	else:
		ans += 1
print(ans)


n = int(input())
l = [{}, {}, {}, {}]
l[0] = {'M': 0, 'L': 0, 'S': 0}
l[1] = {'XS': 0, 'XL': 0}
l[2] = {'XXS': 0, 'XXL': 0}
l[3] = {'XXXS': 0, 'XXXL': 0}
for i in range(0, n):
	b = input()
	l[b.count('X')][b] += 1
for i in range(0, n):
	b = input()
	l[b.count('X')][b] -= 1
sc = 0
for d in l:
	for (k, v) in d.items():
		if v > 0:
			sc += v
print(sc)


n = int(input())
a = []
for i in range(n):
	s = input()
	a.append(s)
b = []
for i in range(n):
	s = input()
	b.append(s)
d = dict()
d2 = dict()
res = 0
for elem in a:
	if elem in d:
		d[elem] += 1
	else:
		d[elem] = 1
for elem in b:
	if elem in d2:
		d2[elem] += 1
	else:
		d2[elem] = 1
for elem in d:
	if elem not in d2:
		d2[elem] = 0
	res += min(d[elem], d2[elem])
print(n - res)


from collections import defaultdict
n = int(input())
(old, new) = ([input() for i in range(n)], [input() for i in range(n)])
(oldd, newd) = (defaultdict(int), defaultdict(int))
for s in old:
	oldd[s] += 1
for s in new:
	newd[s] += 1
ss = oldd['S'] + oldd['M'] + oldd['L'] - min(oldd['S'], newd['S']) - min(oldd['M'], newd['M']) - min(oldd['L'], newd['L'])
ss += oldd['XS'] + oldd['XL'] - min(oldd['XS'], newd['XS']) - min(oldd['XL'], newd['XL'])
ss += oldd['XXS'] + oldd['XXL'] - min(oldd['XXS'], newd['XXS']) - min(oldd['XXL'], newd['XXL'])
ss += oldd['XXXS'] + oldd['XXXL'] - min(oldd['XXXS'], newd['XXXS']) - min(oldd['XXXL'], newd['XXXL'])
print(ss)


n = int(input())
s = []
temp = ''
for k in range(n):
	temp = input()
	s.append(temp)
ans = 0
s2 = []
for k in range(n):
	temp = input()
	if temp in s:
		s.remove(temp)
	else:
		s2.append(temp)
s.sort(key=lambda s: len(s))
s2.sort(key=lambda s: len(s))
for k in range(len(s)):
	ans += sum((1 for (a, b) in zip(s[k], s2[k]) if a != b))
print(ans)


n = int(input())
a = {'M': 0, 'S': 0, 'L': 0, 'XS': 0, 'XL': 0, 'XXS': 0, 'XXL': 0, 'XXXS': 0, 'XXXL': 0}
b = {'M': 0, 'S': 0, 'L': 0, 'XS': 0, 'XL': 0, 'XXS': 0, 'XXL': 0, 'XXXS': 0, 'XXXL': 0}
for i in range(n):
	s = input().strip()
	a[s] += 1
for i in range(n):
	s = input().strip()
	b[s] += 1
cnt = 0
for key in a:
	if a[key] < b[key]:
		cnt += b[key] - a[key]
print(cnt)


n = int(input())
a = []
for i in range(0, 2 * n):
	a.append(input())
c = 0
for i in range(0, n):
	flag = 0
	for j in range(n, 2 * n):
		if a[i] == a[j]:
			flag = 1
			a[j] = '0'
			break
	if flag == 0:
		c += 1
print(c)


n = int(input())
a = []
b = []
for i in range(n):
	atemp = input()
	a.append(atemp)
for i in range(n):
	btemp = input()
	b.append(btemp)
counter = n
for i in range(n):
	for k in range(len(b)):
		if a[i] == b[k]:
			counter += -1
			b.pop(k)
			break
print(counter)


n = int(input())
a1 = [[], [], [], [], []]
for _ in range(n):
	a = input()
	a1[len(a) - 1].append(a)
a2 = [[], [], [], [], []]
for _ in range(n):
	a = input()
	a2[len(a) - 1].append(a)
x1 = a1[0]
x2 = a2[0]
n1 = x1.count('S')
n2 = x1.count('M')
m1 = x2.count('S')
m2 = x2.count('M')
nn1 = n1 - m1
nn2 = n2 - m2
count = max(abs(nn1), abs(nn2), abs(nn1 + nn2))
for i in range(1, 5):
	a1[i].sort()
	a2[i].sort()
	x1 = a1[i]
	x2 = a2[i]
	for j in range(len(x1)):
		if x1[j] != x2[j]:
			count += 1
print(count)


n = int(input())
last = [input() for i in range(n)]
new = [input() for i in range(n)]
result = 0
for (i, x) in enumerate(new):
	for (j, y) in enumerate(last):
		if x == y:
			new[i] = ''
			last[j] = ''
			break
for (i, x) in enumerate(new):
	if x != '':
		(res, ind) = (100000000000000000, 0)
		for (j, y) in enumerate(last):
			if len(x) == len(y):
				cout = 0
				for (item1, item2) in zip(x, y):
					if item1 != item2:
						cout += 1
				if cout < res:
					res = cout
					ind = j
		result += res
		last[ind] = ''
print(result)


n = int(input())
inn = []
win = []
t = n
for i in range(n):
	inn.append(input())
for i in range(n):
	win.append(input())
	if (win[i] in inn) == True and win.count(win[i]) <= inn.count(win[i]):
		t = t - 1
print(t)


x = int(input())
listik = []
for _ in range(x):
	listik += [input()]
listik.sort()
listik2 = []
for _ in range(x):
	listik2 += [input()]
listik2.sort()
counter = 0
for i in range(x):
	if listik[i] not in listik2:
		counter += 1
	else:
		listik2.remove(listik[i])
print(counter)


from collections import defaultdict
n = int(input())
d = defaultdict(int)
for _ in range(n):
	d[input()] += 1
for _ in range(n):
	d[input()] -= 1
print(sum((v for v in d.values() if v > 0)))


from collections import Counter

def printArr(arr):
	for i in arr:
		print(i, end=' ')

def proA(arr1, arr2):
	dic2 = Counter(arr2)
	ans = 0
	for i in arr1:
		if i in dic2:
			if dic2[i] != 0:
				dic2[i] -= 1
				continue
		ans += 1
	return ans
t = int(input())
(arr1, arr2) = ([], [])
for i in range(t):
	n = input()
	arr1.append(n)
for i in range(t):
	n = input()
	arr2.append(n)
print(proA(arr1, arr2))


def compter(a, b, c):
	d = a.count(c)
	e = b.count(c)
	if d > e:
		return d - e
	else:
		return 0
winners = int(input(''))
answer = 0
previous = [''] * winners
current = [''] * winners
for loop in range(winners):
	previous[loop] = input('')
for i in range(winners):
	current[i] = input('')
answer = compter(previous, current, 'S') + compter(previous, current, 'M') + compter(previous, current, 'L') + compter(previous, current, 'XS') + compter(previous, current, 'XL') + compter(previous, current, 'XXS') + compter(previous, current, 'XXL') + compter(previous, current, 'XXXS') + compter(previous, current, 'XXXL')
print(answer)


ls = ['M', 'S', 'XS', 'XXS', 'XXXS', 'L', 'XL', 'XXL', 'XXXL']
x = int(input())
yo = dict()
yo2 = dict()
for i in ls:
	yo[i] = 0
	yo2[i] = 0
for i in range(x):
	z = input()
	yo[z] += 1
for i in range(x):
	z = input()
	yo2[z] += 1
ans = 0
for i in ls[2:5]:
	ans += abs(yo[i] - yo2[i])
for i in ['S', 'M', 'L']:
	if yo[i] > yo2[i]:
		ans += yo[i] - yo2[i]
print(ans)


from collections import *
n = int(input())
I = lambda : Counter((input() for _ in [0] * n))
(a, b) = (I(), I())
r = 0
for i in range(4):
	for c in 'SML':
		s = 'X' * i + c
		r += max(0, a[s] - b[s])
print(r)


n = int(input())
a = {}
b = {}
for i in range(n):
	c = list(input().split())
	for r in c:
		if r in a:
			a[r] += 1
		else:
			a[r] = 1
for i in range(n):
	c = list(input().split())
	for r in c:
		if r in b:
			b[r] += 1
		else:
			b[r] = 1
x = 0
for r in a:
	if r not in b:
		b[r] = 0
for r in b:
	if r in a:
		x += abs(a[r] - b[r])
	else:
		x += b[r]
print(x // 2)


a = int(input())
s = 0
z = [input() for _ in ' ' * a]
for _ in ' ' * a:
	try:
		z.remove(input())
	except:
		s += 1
print(s)


n = int(input())
d = {}
b = []
for i in range(n):
	a = input()
	if a not in d:
		d[a] = 0
	d[a] += 1
for i in range(n):
	b.append(input())
l = d.keys()
c = 0
for i in l:
	k = b.count(i)
	if d[i] > k:
		c += d[i] - k
print(c)


n = int(input())
a = []
b = []
d = {}
for i in range(n):
	a.append(input())
	d[a[i]] = 0
for i in range(n):
	b.append(input())
	d[b[i]] = 0
for i in a:
	d[i] += 1
for i in b:
	d[i] -= 1
ans = 0
for i in d:
	ans += abs(d[i])
print(ans // 2)


n = int(input())
a = {'M': 0, 'S': 0, 'L': 0, 'XL': 0, 'XXL': 0, 'XXXL': 0, 'XS': 0, 'XXS': 0, 'XXXS': 0}
b = {'M': 0, 'S': 0, 'L': 0, 'XL': 0, 'XXL': 0, 'XXXL': 0, 'XS': 0, 'XXS': 0, 'XXXS': 0}
ans = 0
for i in range(n):
	a[input()] += 1
for i in range(n):
	b[input()] += 1
for i in a:
	a[i] = max(a[i] - b[i], 0)
for i in a:
	ans += a[i]
print(ans)


n = int(input())
p = []
q = []
t = []
s = 0
to = []
for x in range(n):
	p.append(input())
for x in range(n):
	q.append(input())
for item in q:
	if len(item) != 1:
		if item in p:
			p.remove(item)
		else:
			for ite in p:
				if len(item) == len(ite):
					p.remove(ite)
					s += 1
					break
	else:
		to.append(item)
for x in range(len(to)):
	for item in p:
		if to[x] != item:
			pass
		else:
			p.remove(item)
			break
print(s + len(p))


n = int(input())
Ar = []
for i in range(n):
	Ar.append(input())
cnt = 0
for i in range(n):
	x = input()
	try:
		Ar.remove(x)
	except:
		cnt += 1
print(cnt)


TN = 1

def solution():
	n = int(input())
	a = []
	for i in range(n):
		a.append(input())
	b = []
	for i in range(n):
		b.append(input())
	ans = 0
	an = []
	for i in range(n):
		if a[i] in b:
			x = b.index(a[i])
			b = b[:x] + b[x + 1:]
		else:
			an.append(a[i])
	for i in range(len(an)):
		x = set(an[i])
		mn = 103
		for j in range(len(b)):
			y = set(b[j])
			if len(an[i]) == len(b[j]):
				if mn > len(x) - len(x & y):
					mn = len(x) - len(x & y)
		ans += mn
	print(ans)
while TN != 0:
	solution()
	TN -= 1


n = int(input())
old = [input() for _ in range(n)]
for _ in range(n):
	try:
		old.remove(input())
	except:
		continue
print(len(old))


from collections import Counter
n = int(input())
d = ['XXXS', 'XXS', 'XS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL']
e = {'S', 'M', 'L'}
ans = 0
A = Counter()
B = Counter()
for i in range(n):
	s = input()
	if s in d:
		A[s] += 1
for i in range(n):
	s = input()
	if s in d:
		B[s] += 1
C = B - A
D = A - B
for i in d:
	for j in e - {i[-1]}:
		j = i[:-1] + j
		c = min(C[i], D[j])
		C[i] -= c
		D[j] -= c
		ans += c
print(ans)


def cmp(x):
	return [len(x), x]
n = int(input())
a = [input() for _ in range(n)]
b = [input() for _ in range(n)]
(m, l, s) = (a.count('M'), a.count('L'), a.count('S'))
(xl, xs) = (a.count('XL'), a.count('XS'))
(xxl, xxs) = (a.count('XXL'), a.count('XXS'))
(xxxl, xxxs) = (a.count('XXXL'), a.count('XXXS'))
(m1, l1, s1) = (b.count('M'), b.count('L'), b.count('S'))
(xl1, xs1) = (b.count('XL'), b.count('XS'))
(xxl1, xxs1) = (b.count('XXL'), b.count('XXS'))
(xxxl1, xxxs1) = (b.count('XXXL'), b.count('XXXS'))
ans = 0
ans += abs(xl - xl1)
ans += abs(xxl - xxl1)
ans += abs(xxxl - xxxl1)
if m > m1:
	ans += m - m1
if l > l1:
	ans += l - l1
if s > s1:
	ans += s - s1
print(ans)


n = int(input())
PreT = []
for i in range(n):
	PreT.append(input())
for j in range(n):
	size = input()
	if size in PreT:
		PreT.remove(size)
print(len(PreT))


n = input()
n = int(n)
mp = {}
for i in range(n):
	s = input()
	if s in mp:
		mp[s] += 1
	else:
		mp[s] = 1
for i in range(n):
	s = input()
	if s in mp:
		mp[s] -= 1
	else:
		mp[s] = -1
ans = 0
for i in mp.values():
	ans += abs(i)
print(ans // 2)


n = [0] * int(input())
pastyear = [*(input() for _ in n)]
for i in range(len(n)):
	tmp = input()
	if tmp in pastyear:
		pastyear.remove(tmp)
print(len(pastyear))


n = int(input())
oldshirts = []
newshirts = []
counter = 0
for k in range(n):
	k = input()
	oldshirts.append(k)
for i in range(n):
	i = input()
	newshirts.append(i)
for u in range(n):
	if newshirts[u] in oldshirts:
		oldshirts.remove(newshirts[u])
print(len(oldshirts))


from copy import deepcopy
import itertools
from bisect import bisect_left
from bisect import bisect_right
import math
from collections import deque

def read():
	return int(input())

def readmap():
	return map(int, input().split())

def readlist():
	return list(map(int, input().split()))
N = read()
A = []
B = []
for _ in range(N):
	A.append(input())
for _ in range(N):
	B.append(input())
A.sort()
B.sort()
A_remove = [False] * N
B_remove = [False] * N
i = 0
j = 0
while i < N and j < N:
	if A[i] == B[j]:
		A_remove[i] = True
		B_remove[j] = True
		i += 1
		j += 1
	elif A[i] < B[j]:
		i += 1
	else:
		j += 1
A_new = []
B_new = []
for i in range(N):
	if not A_remove[i]:
		A_new.append(A[i])
for i in range(N):
	if not B_remove[i]:
		B_new.append(B[i])
print(len(A_new))


n = int(input())
ls1 = list()
ls2 = list()
ls1div = list()
ls2div = list()
count = 0
for i in range(0, n):
	ls1.append(input())
for i in range(0, n):
	ls2.append(input())
for i in range(1, 5):
	ls1div.append([x[-1] for x in ls1 if len(x) == i])
	ls2div.append([x[-1] for x in ls2 if len(x) == i])
	count += abs(ls1div[i - 1].count('S') - ls2div[i - 1].count('S')) + abs(ls1div[i - 1].count('M') - ls2div[i - 1].count('M')) + abs(ls1div[i - 1].count('L') - ls2div[i - 1].count('L'))
print(int(count / 2))


def main():
	num = int(input())
	(newshirts, oldshirts) = ([], [])
	seconds = 0
	for k in range(num):
		newshirts.append(input())
	for k in range(num):
		oldshirts.append(input())
	for i in range(len(newshirts)):
		if newshirts[i] in oldshirts:
			oldshirts[oldshirts.index(newshirts[i])] = None
			newshirts[i] = None
	return len(newshirts) - newshirts.count(None)
print(main())


from collections import defaultdict as dd, deque
n = int(input())
A = [input() for _ in range(n)]
B = [input() for _ in range(n)]
sA = A.count('S')
mA = A.count('M')
lA = A.count('L')
xsA = A.count('XS')
xlA = A.count('XL')
xxsA = A.count('XXS')
xxlA = A.count('XXL')
xxxsA = A.count('XXXS')
xxxlA = A.count('XXXL')
sB = B.count('S')
mB = B.count('M')
lB = B.count('L')
xsB = B.count('XS')
xlB = B.count('XL')
xxsB = B.count('XXS')
xxlB = B.count('XXL')
xxxsB = B.count('XXXS')
xxxlB = B.count('XXXL')
sB = sB - min(sB, sA)
mB = mB - min(mB, mA)
lB = lB - min(lB, lA)
xsB = xsB - min(xsB, xsA)
xxsB = xxsB - min(xxsB, xxsA)
xxxsB = xxxsB - min(xxxsB, xxxsA)
xlB = xlB - min(xlB, xlA)
xxlB = xxlB - min(xxlB, xxlA)
xxxlB = xxxlB - min(xxxlB, xxxlA)
print(sB + mB + lB + xsB + xxsB + xxxsB + xlB + xxlB + xxxlB)


num = int(input())
same = 0
(a, visa) = ([], [])
(b, visb) = ([], [])
for i in range(num):
	a.append(input())
	visa.append(0)
for i in range(num):
	b.append(input())
	visb.append(0)
for i in range(num):
	if visa[i]:
		continue
	for j in range(num):
		if visb[j]:
			continue
		if a[i] == b[j]:
			same += 1
			visa[i] = 1
			visb[j] = 1
			break
print(num - same)


n = int(input())
old = sorted([input() for i in range(n)])
new = sorted([input() for i in range(n)])
s = 0
for t in new:
	if t in old:
		old.remove(t)
	else:
		s += 1
print(s)


n = int(input())
g = [[''] * 4] * 3
c = []
r = []
e = 0
for i in range(n):
	c.append(input())
for i in range(n):
	r.append(input())
for i in range(n):
	for j in range(n):
		if c[i] == r[j]:
			r[j] = 'gorilla'
			c[i] = 'turo_rudi'
			e += 1
print(n - e)


n = int(input())
old = []
new = []
for i in range(0, n):
	old.append(input())
for i in range(0, n):
	new.append(input())
old.sort()
new.sort()
for i in old[:]:
	if i in new:
		old.remove(i)
		new.remove(i)
print(len(old))


t = int(input())
l1 = []
for v in range(0, t):
	x = input()
	l1.append(x)
s = 0
for v in range(0, t):
	y = input()
	if y in l1:
		l1.remove(y)
	else:
		s += 1
print(s)


n = int(input())
(a, b) = ({}, {})
for i in range(0, n):
	s = input()
	a[s] = a[s] + 1 if s in a else 1
for i in range(0, n):
	s = input()
	b[s] = b[s] + 1 if s in b else 1
print(sum(map(lambda t: abs(a.get(t, 0) - b.get(t, 0)), ['M', 'S', 'L', 'XS', 'XL', 'XXS', 'XXL', 'XXXS', 'XXXL'])) // 2)


n = int(input())
inp = 0
a = {}
summ = 0
for i in range(0, n):
	inp = input()
	if inp in a:
		a[inp] += 1
	else:
		a[inp] = 1
for i in range(0, n):
	inp = input()
	if inp in a:
		a[inp] -= 1
	else:
		a[inp] = -1
for elem in a:
	summ += abs(int(a[elem]))
print(summ // 2)


n = int(input())
a = {}
for i in range(n):
	x = input()
	if x in a:
		a[x] += 1
	else:
		a[x] = 1
ans = 0
for i in range(n):
	x = input()
	if x in a and a[x] != 0:
		a[x] = a[x] - 1
		ans += 1
print(n - ans)


n = int(input())
s1 = []
s2 = []
for i in range(n):
	s1.append(input())
for i in range(n):
	s2.append(input())
for v in s1:
	if v in s2:
		s2.remove(v)
print('{}'.format(len(s2)))


import sys, math, queue
MOD = 998244353
sys.setrecursionlimit(1000000)
n = int(input())
a = {'XXXL': 0, 'XXXS': 0, 'XXL': 0, 'XXS': 0, 'XS': 0, 'XL': 0, 'M': 0, 'S': 0, 'L': 0}
b = a.copy()
for i in range(n):
	a[input()] += 1
for i in range(n):
	b[input()] += 1
ans = 0
for k in b:
	ans += abs(a[k] - b[k])
print(ans // 2)


n = int(input())
a = [input().strip() for _ in range(n)]
b = [input().strip() for _ in range(n)]
from collections import Counter
(ac, bc) = (Counter(a), Counter(b))
s = ['M', 'L', 'S', 'XL', 'XXL', 'XXXL', 'XS', 'XXS', 'XXXS']
for s1 in s:
	if s1 in ac and s1 in bc:
		m = min(ac[s1], bc[s1])
		ac[s1] -= m
print(sum((ac[s1] for s1 in s if ac[s1] is not None)))


n = int(input())
clothes = {}
for i in range(n):
	size = input()
	if size not in clothes:
		clothes[size] = 0
	clothes[size] += 1
ans = 0
for i in range(n):
	size = input()
	if size not in clothes or clothes[size] == 0:
		ans += 1
	else:
		clothes[size] -= 1
print(ans)


n = int(input())
old = []
new = []
neededTime = 0
for i in range(n):
	old.append(input())
for i in range(n):
	new.append(input())
for i in range(len(old)):
	for j in range(len(new)):
		if old[i] == new[j]:
			old[i] = ''
			new[j] = ''
for i in range(len(old)):
	if old[i] == '':
		continue
	for j in range(len(new)):
		if new[j] == '':
			continue
		if len(old[i]) == len(new[j]) == 1 and old[i] != new[j]:
			neededTime += 1
			old[i] = ''
			new[j] = ''
			break
		elif len(old[i]) == len(new[j]) == 2 and old[i] != new[j]:
			neededTime += 1
			old[i] = ''
			new[j] = ''
			break
		elif len(old[i]) == len(new[j]) == 3 and old[i] != new[j]:
			neededTime += 1
			old[i] = ''
			new[j] = ''
			break
		elif len(old[i]) == len(new[j]) == 4 and old[i] != new[j]:
			neededTime += 1
			old[i] = ''
			new[j] = ''
			break
print(neededTime)


t = int(input())
a = []
b = []
for i in range(t):
	a.append(input())
for i in range(t):
	b.append(input())
q = set(b)
count = 0
for i in q:
	m = a.count(i)
	n = b.count(i)
	if n <= m:
		count = count + 0
	else:
		count += abs(m - n)
print(count)


n = int(input())
l1 = [input() for _ in range(n)]
for i in range(n):
	s = input()
	if s in l1:
		l1.remove(s)
print(len(l1))


n = int(input())
a = dict()
for i in ['S', 'XS', 'XXS', 'XXXS', 'M', 'L', 'XL', 'XXL', 'XXXL']:
	a[i] = 0
for _ in ' ' * n:
	a[input()] += 1
for _ in ' ' * n:
	a[input()] -= 1
s = 0
for i in a:
	s += abs(a[i])
print(s // 2)


k = int(input())

def tshirts(k):
	minulorocne = []
	for i in range(k):
		minulorocne.append(input())
	tohtorocne = []
	for i in range(k):
		x = input()
		if x in minulorocne:
			minulorocne.remove(x)
		else:
			tohtorocne.append(x)
	if len(minulorocne) != len(tohtorocne):
		return -1
	if len(minulorocne) == 0:
		return 0
	return len(minulorocne)
print(tshirts(k))


n = int(input())
(A, B) = (dict(), dict())
ss = ['XXXS', 'XXS', 'XS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL']
for s in ss:
	A[s] = 0
	B[s] = 0
for i in range(n):
	s = input()
	A[s] += 1
for i in range(n):
	s = input()
	B[s] += 1
print(n - sum([min(A[s], B[s]) for s in ss]))


from collections import Counter
n = int(input())
a = Counter((input() for _ in range(n)))
b = Counter((input() for _ in range(n)))
print(sum((b - a).values()))


n = int(input())
a = []
b = []
ans = 0
for i in range(n):
	a.append(input())
for i in range(n):
	b.append(input())
y = [1] * n
usedA = [0] * n
usedB = [0] * n
x = [1] * n
for i in range(n):
	for j in range(n):
		if usedA[i] == 0 and usedB[j] == 0 and (a[i] == b[j]):
			usedA[i] = 1
			usedB[j] = 1
for i in range(n):
	x[i] = len(a[i])
	y[i] = len(b[i])
for i in range(n):
	for j in range(n):
		if usedA[i] == 0 and usedB[j] == 0:
			if x[i] == y[j]:
				usedA[i] = 1
				usedB[j] = 1
				ans += 1
print(ans)


m = 0
c = 0
l = 0
xl = 0
xxl = 0
xxxl = 0
xs = 0
xxs = 0
xxxs = 0
o = 0
n = int(input())
for i in range(n):
	s = input()
	if s == 'M':
		m = m + 1
	if s == 'S':
		c = c + 1
	if s == 'L':
		l = l + 1
	if s == 'XS':
		xs = xs + 1
	if s == 'XXS':
		xxs = xxs + 1
	if s == 'XXXS':
		xxxs = xxxs + 1
	if s == 'XL':
		xl = xl + 1
	if s == 'XXL':
		xxl = xxl + 1
	if s == 'XXXL':
		xxxl = xxxl + 1
for i in range(n):
	s = input()
	if s == 'M' and m > 0:
		m = m - 1
	if s == 'S' and c > 0:
		c = c - 1
	if s == 'L' and l > 0:
		l = l - 1
	if s == 'XS' and xs > 0:
		xs = xs - 1
	if s == 'XXS' and xxs > 0:
		xxs = xxs - 1
	if s == 'XXXS' and xxxs > 0:
		xxxs = xxxs - 1
	if s == 'XL' and xl > 0:
		xl = xl - 1
	if s == 'XXL' and xxl > 0:
		xxl = xxl - 1
	if s == 'XXXL' and xxxl > 0:
		xxxl = xxxl - 1
o = m + c + l + xl + xxl + xxxl + xs + xxs + xxxs
print(o)


n = int(input())
a1 = {}
a2 = {}
for __ in range(n):
	k = input()
	if k not in a1:
		a1[k] = 0
	a1[k] += 1
for _ in range(n):
	k = input()
	if k not in a2:
		a2[k] = 0
	a2[k] += 1
for j in a1:
	for i in a2:
		if i == j:
			if a1[i] < a2[j]:
				a1[j] = 0
				a2[i] = a2[i] - a1[j]
			else:
				a1[j] -= a2[i]
				a2[i] = 0
print(sum(a1.values()))


from collections import Counter
n = int(input())
a = Counter((input() for i in range(n)))
b = Counter((input() for i in range(n)))
res = 0
for c in 'MLS':
	res += abs(a[c] - b[c])
	res += abs(a['X' + c] - b['X' + c])
	res += abs(a['XX' + c] - b['XX' + c])
	res += abs(a['XXX' + c] - b['XXX' + c])
print(res // 2)


from sys import stdin, stdout
from collections import deque
n = int(stdin.readline())
(a, b) = ([], [])
for i in range(n):
	a.append(stdin.readline().strip())
for i in range(n):
	b.append(stdin.readline().strip())

def comp(s, f):
	cnt = 0
	for i in range(len(s)):
		if s[i] != f[i]:
			cnt += 1
	return cnt
ans = 0
while b:
	(ind1, ind2, cnt) = (-1, -1, float('inf'))
	i = -1
	for s in b:
		i += 1
		j = -1
		for f in a:
			j += 1
			if len(s) != len(f):
				continue
			elif cnt > comp(s, f):
				(ind1, ind2, cnt) = (j, i, comp(s, f))
	ans += cnt
	a.pop(ind1)
	b.pop(ind2)
stdout.write(str(ans))


n = int(input())
a = list()
b = list()
for i in range(n):
	a.append(input())
while True:
	try:
		b.append(input())
	except:
		break
res = 0
for elem in a:
	if elem not in b:
		res += 1
	else:
		del b[b.index(elem)]
print(res)


n = int(input())
L1 = ['M', 'S', 'L', 'X']
L2 = ['XS', 'XL', 'XX']
L3 = ['XXS', 'XXL', 'XXX']
L4 = ['XXXS', 'XXXL']
S = [L1, L2, L3, L4]
D = {}
L = []
for _ in range(n):
	x = input()
	if x in D:
		D[x] += 1
	else:
		D[x] = 1
for _ in range(n):
	L.append(input())
s = 0
D2 = D.copy()
for i in D:
	D[i] = max(0, D[i] - L.count(i))
for j in range(n):
	if L[j] in D2:
		if D2[L[j]] > 0:
			D2[L[j]] -= 1
			L[j] = 0
for i in L:
	if i != 0:
		if i in D:
			if D[i] > 0:
				D[i] -= 1
			else:
				for j in S[len(i) - 1]:
					if D.get(j, 0) > 0:
						D[j] -= 1
						s += 1
						break
		else:
			for j in S[len(i) - 1]:
				if D.get(j, 0) > 0:
					D[j] -= 1
					s += 1
					break
print(s)


n = int(input())
ager = []
porer = []
for i in range(n):
	x = str(input())
	ager.append(x)
for i in range(n):
	y = str(input())
	porer.append(y)
uttar = 0
for i in range(n):
	if ager[i] in porer:
		porer.remove(ager[i])
print(len(porer))


import heapq

class MinCostFlow:

	def __init__(self, n, INF=float('inf')):
		self.n = n
		self.INF = INF
		self.G = [[] for i in range(n)]

	def add_edge(self, fr, to, cap, cost):
		forward = [to, cap, cost, None]
		backward = forward[3] = [fr, 0, -cost, forward]
		self.G[fr].append(forward)
		self.G[to].append(backward)

	def flow(self, s, t, f):
		res = 0
		H = [0] * self.n
		prevv = [0] * self.n
		preve = [None] * self.n
		d0 = [self.INF] * self.n
		dist = [self.INF] * self.n
		while f:
			dist[:] = d0
			dist[s] = 0
			que = [(0, s)]
			heapq.heapify(que)
			while que:
				(c, v) = heapq.heappop(que)
				if dist[v] < c:
					continue
				r0 = dist[v] + H[v]
				for e in self.G[v]:
					(w, cap, cost, _) = e
					if cap > 0 and r0 + cost - H[w] < dist[w]:
						dist[w] = r = r0 + cost - H[w]
						prevv[w] = v
						preve[w] = e
						heapq.heappush(que, (r, w))
			if dist[t] == self.INF:
				return -1
			for i in range(self.n):
				H[i] += dist[i]
			d = f
			v = t
			while v != s:
				d = min(d, preve[v][1])
				v = prevv[v]
			f -= d
			res += d * H[t]
			v = t
			while v != s:
				e = preve[v]
				e[1] -= d
				e[3][1] += d
				v = prevv[v]
		return res
INF = 10 ** 18
import sys
import io, os
input = sys.stdin.readline
n = int(input())
d = {'M': 0}
idx = 0
for i in range(4):
	idx += 1
	d['X' * i + 'S'] = idx
	idx += 1
	d['X' * i + 'L'] = idx
from collections import Counter
A = [str(input().rstrip()) for i in range(n)]
B = [str(input().rstrip()) for i in range(n)]
CA = Counter(A)
CB = Counter(B)
mf = MinCostFlow(20)
s = 18
t = 19
for (k, v) in CA.items():
	mf.add_edge(s, d[k], v, 0)
for (k, v) in CB.items():
	mf.add_edge(d[k] + 9, t, v, 0)
for i in range(3):
	for j in range(3):
		if i == j:
			mf.add_edge(i, j + 9, INF, 0)
		else:
			mf.add_edge(i, j + 9, INF, 1)
for i in range(3, 5):
	for j in range(3, 5):
		if i == j:
			mf.add_edge(i, j + 9, INF, 0)
		else:
			mf.add_edge(i, j + 9, INF, 1)
for i in range(5, 7):
	for j in range(5, 7):
		if i == j:
			mf.add_edge(i, j + 9, INF, 0)
		else:
			mf.add_edge(i, j + 9, INF, 1)
for i in range(7, 9):
	for j in range(7, 9):
		if i == j:
			mf.add_edge(i, j + 9, INF, 0)
		else:
			mf.add_edge(i, j + 9, INF, 1)
ans = mf.flow(s, t, n)
print(ans)


n = int(input())
L = ['M', 'S', 'XS', 'XXS', 'XXXS', 'L', 'XL', 'XXL', 'XXXL']
L1 = []
dA = {}
dB = {}
for i in L:
	dA[i] = 0
	dB[i] = 0
for i in range(n):
	x = input()
	dA[x] += 1
for i in range(n):
	x = input()
	dB[x] += 1
count = 0
for i in L:
	x = dB[i] - dA[i]
	if x > 0:
		count += x
print(count)