Given two arrays of integers, find which elements in the second array are missing from the first array.

Example 

$arr=[7,2,5,3,5,3]$ 

$brr=[7,2,5,4,6,3,5,3]$

The $brr$ array is the orginal list.  The numbers missing are $[4,6]$.  

Notes  

If a number occurs multiple times in the lists, you must ensure that the frequency of that number in both lists is the same. If that is not the case, then it is also a missing number. 
Return the missing numbers sorted ascending. 
Only include a missing number once, even if it is missing multiple times. 
The difference between the maximum and minimum numbers in the original list is less than or equal to $100$.  

Function Description  

Complete the missingNumbers function in the editor below.  It should return a sorted array of missing numbers.  

missingNumbers has the following parameter(s):

int arr[n]: the array with missing numbers   
int brr[m]: the original array of numbers   

Returns   

int[]: an array of integers   

Input Format

There will be four lines of input:  

$n$ - the size of the first list, $\textbf{arr}$ 

 The next line contains $n$ space-separated integers $arr\left[i\right]$ 

 $m$ - the size of the second list, $brr$ 

 The next line contains $m$ space-separated integers $brr[i]$  

Constraints

$1\leq n,m\leq2\times10^5$  
$n\leq m$
$1\leq b r r[i]\leq10^4$  
$max(brr)-min(brr)\leq100$

Sample Input
10
203 204 205 206 207 208 203 204 205 206
13
203 204 204 205 206 207 205 208 203 206 205 206 204

Sample Output
204 205 206

Explanation

$\textbf{204}$ is present in both arrays. Its frequency in $\textbf{arr}$ is $2$, while its frequency in $brr$ is $3$. Similarly, $205$ and $\textbf{206}$ occur twice in $\textbf{arr}$, but three times in $brr$. The rest of the numbers have the same frequencies in both lists.

Difficulty: EASY
Tags: Complete search
Skill types: Complete search

Starter code:

Solutions:
n = int(input())
A = [int(i) for i in input().split()]
m = int(input())
B = [int(i) for i in input().split()]
vals = {}
for i in A:
	if i not in vals:
		vals[i] = -1
	else:
		vals[i] -= 1
for i in B:
	if i not in vals:
		vals[i] = 1
	else:
		vals[i] += 1
pos = []
for i in vals:
	if vals[i] > 0:
		pos.append(i)
pos.sort()
for i in pos:
	print(i, end=' ')


def main():
	lenA = int(sys.stdin.readline())
	A = [int(x) for x in sys.stdin.readline().split()]
	lenB = int(sys.stdin.readline())
	B = [int(x) for x in sys.stdin.readline().split()]
	mapA = [0 for x in range(0, 20001)]
	mapB = [0 for x in range(0, 20001)]
	for a in A:
		aIndex = a + 10000
		mapA[aIndex] = mapA[aIndex] + 1
	for b in B:
		bIndex = b + 10000
		mapB[bIndex] = mapB[bIndex] + 1
	for i in range(0, 20001):
		if mapA[i] == mapB[i]:
			continue
		else:
			print(i - 10000, end=' ')
	print()
import sys
main()


def diff(A, B):
	z = range(min(B), max(B) + 1)
	dA = {i: 0 for i in z}
	dB = {i: 0 for i in z}
	for a in A:
		dA[a] += 1
	for b in B:
		dB[b] += 1
	output = ''
	for i in z:
		if dB[i] - dA[i] != 0:
			output += str(i) + ' '
	return output
N = int(input().strip())
A = list(map(int, input().strip().split(' ')))
M = int(input().strip())
B = list(map(int, input().strip().split(' ')))
print(diff(A, B))


n = int(input())
l = input().split()
max = -20000
min = 20000
for i in range(n):
	l[i] = int(l[i])
	if l[i] > max:
		max = l[i]
	if l[i] < min:
		min = l[i]
mark = [0 for i in range(0, max - min + 1)]
for i in l:
	mark[i - min] += 1
m = int(input())
l = input().split()
for i in range(0, m):
	mark[int(l[i]) - min] -= 1
n = n - m
for i in range(0, max - min + 1):
	if 0 == n:
		break
	if mark[i] != 0:
		print(i + min, end=' ')
print()


n = int(input())
a = input().split()
a = [int(a[i]) for i in range(n)]
m = int(input())
b = input().split()
b = [int(b[i]) for i in range(m)]
i = j = 0
c = []
d = []
start = min(b)
end = max(b)
for i in range(start, end + 1, 1):
	c.append(a.count(i))
	d.append(b.count(i))
for i in range(len(d)):
	if c[i] < d[i]:
		print(start + i, end=' ')


def main():
	testcase = int(input())
	original = [int(i) for i in input().split()]
	testcase2 = int(input())
	new = [int(j) for j in input().split()]
	test = {}
	numbers = []
	out = ''
	for x in original:
		if x not in test:
			test[x] = 1
		else:
			test[x] += 1
	for y in new:
		if y in original:
			test[y] -= 1
		else:
			numbers.append(y)
	for z in test:
		if test[z] < 0:
			numbers.append(z)
	numbers.sort()
	for i in numbers:
		out += str(i) + ' '
	print(out)
main()


def diff(A, B):
	i = 0
	L = {}
	for i in range(len(A)):
		if B[i] not in L:
			L[B[i]] = 1
		else:
			L[B[i]] += 1
		if A[i] not in L:
			L[A[i]] = -1
		else:
			L[A[i]] -= 1
	for i in range(len(A), len(B)):
		if B[i] not in L:
			L[B[i]] = 1
		else:
			L[B[i]] += 1
	for x in L.keys():
		if L[x]:
			print(x, end=' ')
str = input()
A = [int(x) for x in input().split()]
str = input()
B = [int(x) for x in input().split()]
diff(A, B)


import sys
n = int(input())
A = str(input())
m = int(input())
B = str(input())
A = A.split()
B = B.split()
dic_A = {}
dic_B = {}
for i in range(n):
	if not A[i] in dic_A:
		dic_A[A[i]] = 1
	else:
		dic_A[A[i]] += 1
for i in range(m):
	if not B[i] in dic_B:
		dic_B[B[i]] = 1
	else:
		dic_B[B[i]] += 1
for key in sorted(dic_A):
	if not key in dic_B:
		print(key, end=' ')
	elif dic_A[key] < dic_B[key]:
		print(key, end=' ')


AN = int(input())
A = input().lstrip().rstrip().split(' ')
A = [int(i) for i in A]
BN = int(input())
B = input().lstrip().rstrip().split(' ')
B = [int(i) for i in B]
if len(A) > len(B):
	(A, B) = (B, A)
min_b = min(B)
b_nums = [0 for i in range(min_b, min_b + 101)]
for i in B:
	b_nums[i - min_b] += 1
for i in A:
	b_nums[i - min_b] -= 1
output = []
for i in range(len(b_nums)):
	if b_nums[i] != 0:
		output.append(i + min_b)
output.sort()
print(*output)


from collections import Counter

def main():
	A = int(input())
	LA = list(map(int, input().split()))
	B = int(input())
	LB = list(map(int, input().split()))
	(CA, CB) = (Counter(LA), Counter(LB))
	keys = list(CB.keys())
	keys.sort()
	for b in keys:
		if CB[b] - CA.get(b, 0) > 0:
			print(b, end=' ')
main()


n1 = int(input())
ar1 = input().split()
n2 = int(input())
ar2 = input().split()
ar1 = sorted(list(map(int, ar1)))
ar2 = sorted(list(map(int, ar2)))
ar3 = list(set(ar2))
final = ''
for ch in ar3:
	if ar2.count(ch) > ar1.count(ch):
		final = final + str(ch) + ' '
print(final)


import sys
n = int(sys.stdin.readline())
ar_a = [int(x) for x in sys.stdin.readline().split()]
dict_a = {}
m = int(sys.stdin.readline())
ar_b = [int(x) for x in sys.stdin.readline().split()]
dict_b = {}
for a in ar_a:
	dict_a[a] = dict_a.get(a, 0) + 1
for b in ar_b:
	dict_b[b] = dict_b.get(b, 0) + 1
diffs = []
for (k, v) in dict_b.items():
	if not k in dict_a or v > dict_a[k]:
		diffs.append(str(k))
print(' '.join(sorted(diffs)))


def find_smallest_sums():
	num_list1 = int(input())
	arr1 = [int(x) for x in str(input()).strip().split(' ')]
	num_list2 = int(input())
	arr2 = [int(x) for x in str(input()).strip().split(' ')]
	glob_dict = {}
	result_list = []
	for elem in arr2:
		if elem in glob_dict:
			glob_dict[elem] += 1
		else:
			glob_dict[elem] = 1
	for elem in arr1:
		if elem in glob_dict:
			glob_dict[elem] -= 1
			if glob_dict[elem] == 0:
				del glob_dict[elem]
	for key in glob_dict:
		if glob_dict[key] > 0:
			result_list.append(key)
	return ' '.join([str(x) for x in sorted(result_list)])

def main():
	print(find_smallest_sums())
main()


n = int(input())
A = [int(i) for i in input().split()]
m = int(input())
B = [int(i) for i in input().split()]
from collections import defaultdict
d = defaultdict(lambda : 0)
for i in B:
	d[i] += 1
for i in A:
	d[i] -= 1
ar = []
for i in d.keys():
	if d[i] > 0:
		ar.append(i)
ar.sort()
print(*ar)


def frequency_map(first_list):
	first_dict = dict()
	for entry in first_list:
		if entry in first_dict:
			first_dict[entry] += 1
		else:
			first_dict[entry] = 1
	return first_dict
first_size = int(input())
first_list = input().strip().split()
first_dict = frequency_map(first_list)
second_size = int(input())
second_list = input().strip().split()
second_dict = frequency_map(second_list)
diff_set = set()
for entry in second_dict:
	if not entry in first_dict or second_dict[entry] - first_dict[entry] > 0:
		diff_set.add(entry)
diff_set = list(diff_set)
diff_set.sort()
for entry in diff_set:
	print(entry, end=' ')


num_a = int(input())
a_temp = input().strip().split(' ')
a = []
for x in a_temp:
	a.append(int(x))
num_b = int(input())
b_temp = input().strip().split(' ')
b = []
for x in b_temp:
	b.append(int(x))
ha = {}
for x in a:
	if x in ha:
		ha[x] += 1
	else:
		ha[x] = 1
hb = {}
for x in b:
	if x in hb:
		hb[x] += 1
	else:
		hb[x] = 1
result = []
for x in hb:
	if x not in ha:
		result.append(x)
	elif hb[x] > ha[x]:
		result.append(x)
print(' '.join(map(str, result)))


n = int(input())
A = [int(i) for i in input().split()]
m = int(input())
B = [int(i) for i in input().split()]
vals = {}
for i in A:
	if i not in vals:
		vals[i] = -1
	else:
		vals[i] -= 1
for i in B:
	if i not in vals:
		vals[i] = 1
	else:
		vals[i] += 1
pos = []
for i in vals:
	if vals[i] > 0:
		pos.append(i)
pos.sort()
for i in pos:
	print(i, end=' ')


import sys
from collections import deque
import heapq
from math import *
from itertools import *
PI = pi
INF = 1000000000

def gl():
	return input()

def gs():
	return (x for x in input().split())

def gi():
	return int(input())

def gis():
	return [int(x) for x in input().split()]

def gf():
	return float(input())

def gfs():
	return [float(x) for x in input().split()]

def even(x):
	return x % 2 == 0

def odd(x):
	return x % 2 == 1

def dbg(s):
	print(s, file=sys.stderr)
Ac = gi()
A = gis()
Bc = gi()
B = gis()
(Ad, Bd) = ({}, {})
for i in A:
	Ad[i] = Ad.get(i, 0) + 1
for i in B:
	Bd[i] = Bd.get(i, 0) + 1
values = []
for (k, v) in sorted(Bd.items()):
	if Ad.get(k, 0) != Bd[k]:
		values.append(k)
print(' '.join((str(x) for x in values)))


n = int(input().strip())
a = input().strip().split()
m = int(input().strip())
b = input().strip().split()
i = 0
j = 0
lst = []
a_map = {}
for i in a:
	if i in a_map:
		a_map[i] += 1
	else:
		a_map[i] = 1
for i in b:
	if i in a_map and a_map[i] > 0:
		a_map[i] -= 1
	elif i not in lst:
		lst.append(i)
lst.sort()
print(' '.join(lst))


a_count = int(input())
a = input().strip()
a = list(map(int, a.split(' ')))
b_count = int(input())
b = input().strip()
b = list(map(int, b.split(' ')))
bc = {}
for i in b:
	if not i in bc:
		bc[i] = 1
	else:
		bc[i] += 1
ac = {}
for i in a:
	if not i in ac:
		ac[i] = 1
	else:
		ac[i] += 1
missing = []
for i in bc.keys():
	if i not in ac:
		missing.append(str(i))
	elif bc[i] > ac[i]:
		missing.append(str(i))
print(' '.join(sorted(missing)))


from collections import defaultdict

def missing_number(A, B):
	numbers = defaultdict(int)
	for i in A:
		numbers[i] -= 1
	for i in B:
		numbers[i] += 1
	temp = [i for i in numbers.keys() if numbers[i] > 0]
	sorted(temp)
	print(' '.join(map(str, temp)))
n = int(input())
A = list(map(int, input().split()))
m = int(input())
B = list(map(int, input().split()))
missing_number(A, B)


import sys

def countItems(L):
	result = {}
	for item in L:
		if item in result:
			result[item] += 1
		else:
			result[item] = 1
	return result
sys.stdin.readline()
A = countItems([int(s) for s in sys.stdin.readline().strip().split(' ')])
sys.stdin.readline()
B = countItems([int(s) for s in sys.stdin.readline().strip().split(' ')])
diff = []
for n in B:
	if n not in A or A[n] < B[n]:
		diff.append(n)
diff.sort()
print(' '.join([str(n) for n in diff]))


first_size = int(input())
first_list = [int(val) for val in input().split(' ') if val != '']
second_size = int(input())
second_list = [int(val) for val in input().split(' ') if val != '']
second_val = {}
result = ''
for val in second_list:
	if val in second_val:
		second_val[val] += 1
	else:
		second_val[val] = 1
for val in first_list:
	second_val[val] -= 1
sorted(second_val, key=second_val.get)
for (key, value) in second_val.items():
	if value > 0:
		result += str(key) + ' '
print(result)


a = input()
A = input()
b = input()
B = input()
A = A.split(' ')
A = [int(x) for x in A if x != '']
B = B.split(' ')
B = [int(x) for x in B if x != '']
hash = {}
for x in range(int(b)):
	if B[x] not in hash:
		hash[B[x]] = 1
	else:
		hash[B[x]] = hash[B[x]] + 1
for x in range(int(a)):
	if A[x] in hash:
		if hash[A[x]] == 1:
			del hash[A[x]]
		elif hash[A[x]] > 1:
			hash[A[x]] = hash[A[x]] - 1
results = []
for (key, value) in hash.items():
	results.append(key)
results.sort()
print(' '.join([str(x) for x in results]))


def dictionize(arr):
	A = {}
	for i in arr:
		A[i] = A.get(i, 0) + 1
	return A

def missing_numbers(m, a, n, b):
	result = []
	A = dictionize(a)
	for i in b:
		if A.get(i, 0):
			A[i] -= 1
		else:
			result.append(i)
	result = list(set(result))
	result.sort()
	return result
m = input().strip()
a = input().strip()
a = list(map(int, a.split(' ')))
n = input().strip()
b = input().strip()
b = list(map(int, b.split(' ')))
print(' '.join(map(str, missing_numbers(m, a, n, b))))


n = int(input())
vn = [int(i) for i in input().strip().split()]
m = int(input())
vm = [int(i) for i in input().strip().split()]
dn = {}
dm = {}
for e in vn:
	dn[e] = dn.get(e, 0) + 1
for e in vm:
	dm[e] = dm.get(e, 0) + 1
res = []
for (e, v) in dm.items():
	diff = v - dn.get(e, 0)
	if diff:
		res.append(e)
res.sort()
print(*res, sep=' ')


def printList(list):
	for x in list:
		print(x, end=' ')
	print()

def missing(listA, listB):
	freqA = [0 for x in range(20002)]
	freqB = [0 for x in range(20002)]
	for a in listA:
		freqA[a + 10000] = freqA[a + 10000] + 1
	for b in listB:
		freqB[b + 10000] = freqB[b + 10000] + 1
	result = []
	for i in range(20002):
		if freqA[i] != freqB[i]:
			result.append(i - 10000)
	return result

def main():
	A = int(input())
	listA = [int(x) for x in input().split()]
	B = int(input())
	listB = [int(x) for x in input().split()]
	printList(missing(listA, listB))
main()


import collections

def getAnswer(a, b):
	return sorted([i for i in b.keys() if b.get(i) - a.get(i) > 0])
from collections import Counter
a1 = int(input())
hash1 = Counter(map(int, input().strip().split(' ')))
a2 = int(input())
hash2 = Counter(map(int, input().strip().split(' ')))
print(' '.join(map(str, getAnswer(hash1, hash2))))


from collections import Counter
aSize = int(input().strip())
a = input().strip()
a = list(map(int, a.split(' ')))
bSize = int(input().strip())
b = input().strip()
b = list(map(int, b.split(' ')))
diff = Counter(b) - Counter(a)
print(' '.join(map(str, sorted(diff))))


from collections import Counter

def artisinal_diff(A, B):
	AC = Counter()
	BC = Counter()
	missing = set()
	for a in A:
		AC[a] += 1
	for b in B:
		BC[b] += 1
	for (key, val) in BC.items():
		if AC[key] != val:
			missing.add(key)
	return missing
l1 = int(input())
A = list(input().strip().split(' '))
l2 = int(input())
B = list(input().strip().split(' '))
print(' '.join(map(str, sorted(list(artisinal_diff(A, B))))))


def f3(seq):
	keys = {}
	for e in seq:
		keys[e] = 1
	return keys.keys()
la = input()
a = input().split()
lb = input()
b = input().split()
c = set(b)
ans = [i for i in c if b.count(i) > a.count(i)]
ans = list(f3(ans))
ans.sort()
print(' '.join(ans))


from collections import Counter
n = input()
l1 = map(int, input().strip().split(' '))
n = input()
l2 = map(int, input().strip().split(' '))
d = list((Counter(l2) - Counter(l1)).elements())
d = list(set(d))
d.sort()
for i in d:
	print(i, end=' ')


n = int(input())
Ln = [int(x) for x in input().strip().split(' ')]
m = int(input())
Lm = [int(x) for x in input().strip().split(' ')]
A = {}
for en in Ln:
	A[en] = A.get(en, 0) + 1
for em in Lm:
	A[em] = A.get(em, 0) - 1
nums = []
for k in A:
	if A[k] < 0:
		nums.append(k)
nums.sort()
print(' '.join([str(x) for x in nums]))


n = int(input())
a = input()
m = int(input())
b = input()
a = [int(i) for i in a.strip().split(' ')]
b = [int(i) for i in b.strip().split(' ')]
fl = []
l = []
for i in a:
	if i not in l:
		l.append(i)
		fl.append(1)
	else:
		k = l.index(i)
		fl[k] += 1
b.sort()
for i in range(len(l)):
	k = b.index(l[i])
	del b[k:k + fl[i]]
b = list(set(b))
b.sort()
for i in range(len(b) - 1):
	print(b[i], end=' ')
print(b[len(b) - 1])


from collections import Counter
input()
A = Counter(input().split())
input()
B = Counter(input().split())
B.subtract(A)
diffs = B + Counter()
print(' '.join((x for x in sorted(diffs))))


import sys
n1 = sys.stdin.readline()
a = [int(i) for i in sys.stdin.readline().strip().split(' ')]
n2 = sys.stdin.readline()
b = [int(i) for i in sys.stdin.readline().strip().split(' ')]
count_a = [0] * 30000
count_b = [0] * 30000
for i in a:
	count_a[i + 10000] += 1
for i in b:
	count_b[i + 10000] += 1
diff_arr = []
for i in range(0, len(count_b)):
	if count_b[i] > 0 and count_b[i] > count_a[i]:
		diff_arr.append(i - 10000)
diff_arr.sort()
print(' '.join((str(x) for x in diff_arr)))


from collections import Counter
a = int(input())
A = list(map(int, input().strip().split(' ')))
b = int(input())
B = list(map(int, input().strip().split(' ')))
counterA = Counter(A)
counterB = Counter(B)
missing = []
for (key, value) in counterB.items():
	if value > counterA[key]:
		missing.append(key)
for element in missing:
	print(element, end=' ')


import sys
numA = int(sys.stdin.readline())
A = [int(x) for x in sys.stdin.readline().strip('\n').split(' ')[:]]
numB = int(sys.stdin.readline())
B = [int(x) for x in sys.stdin.readline().strip('\n').split(' ')[:]]
sA = set(A)
sB = set(B)
for el in sB:
	if B.count(el) - A.count(el) > 0:
		print(el, end=' ')


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
xmin = min(min(a), min(b))
counts = 101 * [0]
for x in a:
	counts[x - xmin] += 1
for x in b:
	counts[x - xmin] -= 1
for i in range(len(counts)):
	if counts[i] < 0:
		print(xmin + i, end=' ')
print()


n = int(input())
a = input().split(' ')
m = int(input())
b = input().split(' ')
an = []
z = [0 for i in range(100)]
A = [int(i) for i in a]
B = [int(j) for j in b]
mn = min(B)
for r in range(n):
	z[A[r] - mn] += 1
for q in range(m):
	if z[B[q] - mn] <= 0 and B[q] not in an:
		an.append(B[q])
	else:
		z[B[q] - mn] -= 1
ans = ''
an.sort()
for l in an:
	ans += str(l) + ' '
print(ans)


na = int(input())
arrA = input()
int_a = [int(i) for i in arrA.strip().split()]
nb = int(input())
arrB = input()
int_b = [int(i) for i in arrB.strip().split()]
A = dict()
for each in int_b:
	if each in A:
		A[each] += 1
	else:
		A[each] = 1
for each in int_a:
	if each in A:
		if A[each] > 1:
			A[each] = A[each] - 1
		else:
			del A[each]
line = ''
for each in A.keys():
	line = '%s %d' % (line, each)
print(line[1:])


import sys
from collections import Counter

def main():
	n = int(sys.stdin.readline())
	a = Counter([int(i) for i in sys.stdin.readline().split()])
	m = int(sys.stdin.readline())
	b = Counter([int(i) for i in sys.stdin.readline().split()])
	differences = set()
	for i in b:
		if i in a and b[i] > a[i]:
			differences.add(i)
		elif i not in a:
			differences.add(i)
	differences = list(differences)
	differences.sort()
	differences = [str(i) for i in differences]
	print(' '.join(differences))
main()


n1 = int(input())
a = list(map(int, input().split()))
n2 = int(input())
b = list(map(int, input().split()))
m = min(a[0], b[0])
stat = dict(((x, 0) for x in range(m - 100, m + 100)))
for x in a:
	stat[x] += 1
for x in b:
	stat[x] -= 1
for (k, v) in stat.items():
	if v < 0:
		print(k, end=' ')


import sys
sizea = int(sys.stdin.readline().strip())
arraya = sys.stdin.readline().split()
sizeb = int(sys.stdin.readline().strip())
arrayb = sys.stdin.readline().split()
counts = {}
for i in arrayb:
	if i in counts:
		counts[i] += 1
	else:
		counts[i] = 1
for i in arraya:
	counts[i] -= 1
print(' '.join(sorted(list(set([i for i in counts.keys() if counts[i] > 0])))))


n = int(input())
nl = [int(val) for val in str(input()).split()]
t = int(input())
tl = [int(val) for val in str(input()).split()]
tel = {}
for i in range(t):
	j = tl[i]
	if j in tel:
		tel[j] -= 1
	else:
		tel[j] = -1
	if i < n:
		j = nl[i]
		if j in tel:
			tel[j] += 1
		else:
			tel[j] = 1
a = []
for (k, v) in tel.items():
	if v != 0:
		a.append(k)
a.sort()
print(*a, sep=' ')


n = int(input())
l1 = [int(val) for val in str(input()).split()]
m = int(input())
l2 = [int(val) for val in str(input()).split()]
l3 = {}
for i in range(m):
	j = l2[i]
	if j in l3:
		l3[j] -= 1
	else:
		l3[j] = -1
	if i < n:
		j = l1[i]
		if j in l3:
			l3[j] += 1
		else:
			l3[j] = 1
a = []
for (i, j) in l3.items():
	if j != 0:
		a.append(i)
a.sort()
print(*a, sep=' ')


n = int(input())
A = list(map(int, str(input()).strip().split()))
m = int(input())
B = list(map(int, str(input()).strip().split()))
offset = 100 - B[0]
buckets = [0 for i in range(201)]
for b in B:
	buckets[b + offset] += 1
for a in A:
	buckets[a + offset] -= 1
missing = []
for (i, count) in enumerate(buckets):
	if count > 0:
		missing.append(i - offset)
print(' '.join(map(str, missing)))


import sys
import collections
n = int(input())
ar = [int(x) for x in input().split()]
m = int(input())
ar2 = [int(x) for x in input().split()]

def missing(A, B):
	a = collections.Counter(A)
	b = collections.Counter(B)
	missing = []
	for el in b:
		if a[el] < b[el]:
			missing.append(el)
	return missing
print(' '.join(map(str, missing(ar, ar2))))


numA = int(input())
arrayA = [int(x) for x in input().split()]
numB = int(input())
arrayB = [int(x) for x in input().split()]
diff = []
dictA = {}
dictB = {}
for i in arrayA:
	if i not in dictA:
		dictA[i] = 1
	else:
		dictA[i] += 1
for i in arrayB:
	if i not in dictB:
		dictB[i] = 1
	else:
		dictB[i] += 1
for i in dictB:
	if i not in dictA and i not in diff:
		diff.append(i)
	elif dictB[i] != dictA[i] and i not in diff:
		diff.append(i)
print(' '.join([str(x) for x in diff]).strip())


import fileinput

def add(string, potential_add, last_add):
	if last_add == potential_add:
		return string
	else:
		string += str(potential_add) + ' '
		return string
for line in fileinput.input():
	if fileinput.lineno() == 1:
		first_line_count = int(line)
	elif fileinput.lineno() == 2:
		first_line_numbers = [int(x) for x in line.split(' ')]
		first_line_numbers.sort()
	elif fileinput.lineno() == 3:
		second_line_count = int(line)
	elif fileinput.lineno() == 4:
		second_line_numbers = [int(x) for x in line.split(' ')]
		second_line_numbers.sort()
first_line_index = 0
last_added = 10000000
result = ''
for i in range(0, len(second_line_numbers)):
	current_number = second_line_numbers[i]
	if len(first_line_numbers) == first_line_index:
		result = add(result, current_number, last_added)
		last_added = current_number
	elif first_line_numbers[first_line_index] == current_number:
		first_line_index += 1
	else:
		result = add(result, current_number, last_added)
		last_added = current_number
print(result)


from itertools import zip_longest
input()
ar1 = [int(i) for i in input().split()]
input()
ar2 = [int(i) for i in input().split()]
delta = ar1[0] - 100
hist = [0] * 200
for (e1, e2) in zip_longest(ar1, ar2):
	if e1 is not None:
		hist[e1 - delta] -= 1
	hist[e2 - delta] += 1
print(' '.join((str(i + delta) for (i, e) in enumerate(hist) if e > 0)))


from collections import defaultdict

def diffArr(arr1, arr2):
	larger = arr1 if len(arr1) > len(arr2) else arr2
	smaller = arr1 if larger == arr2 else arr2
	buckets = defaultdict(int)
	for e in larger:
		buckets[e] += 1
	for e in smaller:
		buckets[e] -= 1
	return [k for (k, v) in buckets.items() if v != 0]
input()
arr1 = [int(x) for x in input().split()]
input()
arr2 = [int(x) for x in input().split()]
diff = diffArr(arr1, arr2)
out = ''
for e in diff:
	out = out + str(e) + ' '
print(out.rstrip())


n = int(input())
A = [int(i) for i in str(input()).split()]
m = int(input())
B = [int(i) for i in str(input()).split()]
X_min = min(B)
freq_A = [0] * 100
freq_B = [0] * 100
for e in A:
	freq_A[e - X_min] += 1
for e in B:
	freq_B[e - X_min] += 1
ans = []
v = X_min
for (i, j) in zip(freq_A, freq_B):
	if i != j:
		ans.append(str(v))
	v += 1
print(' '.join(ans))


input()
a = [int(x) for x in input().split()]
input()
b = [int(x) for x in input().split()]
d = dict()
for x in b:
	if x in d:
		d[x] += 1
	else:
		d[x] = 1
for x in a:
	d[x] -= 1
c = sorted([x for x in d if d[x] > 0])
print(' '.join(map(str, c)))


lenth1 = input()
list1 = input().split()
nlist1 = tuple(set(list1))
lenth2 = input()
list2 = input().split()
nlist2 = tuple(set(list2))
tmplist = []
for i in nlist1:
	try:
		if list2.count(i) > list1.count(i):
			tmplist.append(i)
	except:
		pass
tmplist.sort()
print(' '.join(tmplist))


n = int(input())
data1 = input().split(' ')
m = int(input())
data2 = input().split(' ')
l1 = len(data1)
l2 = len(data2)
d1 = {}
d2 = {}
for i in range(0, l1):
	if data1[i] in d1.keys():
		d1[data1[i]] += 1
	else:
		d1[data1[i]] = 1
for i in range(0, l2):
	if data2[i] in d2.keys():
		d2[data2[i]] += 1
	else:
		d2[data2[i]] = 1
s = ''
ls = []
for i in range(0, l2):
	try:
		key = data2[i]
		if d2[key] > d1[key]:
			if key not in ls:
				ls.append(key)
	except:
		if key not in ls:
			ls.append(key)
ls.sort()
for item in ls:
	s += item + ' '
print(s)


import sys
import collections
sys.stdin.readline()
A = [int(X) for X in sys.stdin.readline().split()]
sys.stdin.readline()
B = [int(X) for X in sys.stdin.readline().split()]
Adict = collections.defaultdict(int)
for a in A:
	Adict[a] += 1
Bdict = collections.defaultdict(int)
for b in B:
	Bdict[b] += 1
diff = set(Bdict.items()) - set(Adict.items())
answers = sorted([x for (x, y) in diff])
for answer in answers:
	print(answer, end=' ')
print()


from collections import defaultdict
M = int(input())
a = [int(x) for x in input().split()]
N = int(input())
b = [int(x) for x in input().split()]
d = defaultdict(int)
for x in b:
	d[x] += 1
for x in a:
	d[x] -= 1
	if d[x] == 0:
		d.pop(x)
print(' '.join([str(x) for x in sorted(d)]))


n = int(input())
narr = [int(v) for v in input().split()]
m = int(input())
marr = [int(v) for v in input().split()]
r = {}
for nn in narr:
	if nn not in r:
		r[nn] = 0
	r[nn] += 1
for mm in marr:
	if mm not in r:
		r[mm] = 0
	r[mm] -= 1
rr = []
for i in r:
	if r[i] < 0:
		rr.append(i)
print(' '.join([str(v) for v in sorted(rr)]))


aSize = int(input())
aArr = input().split()
bSize = int(input())
bArr = input().split()
counter = dict()
for a in aArr:
	if a in counter:
		counter[a] += 1
	else:
		counter[a] = 1
missing = []
for b in bArr:
	if b in counter:
		counter[b] -= 1
		if counter[b] == 0:
			del counter[b]
	else:
		missing.append(b)
missing = list(set(missing))
missing.sort()
print(' '.join(missing))


import sys

def insert_into_dict(l):
	d1ct = {}
	for num in l:
		d1ct[num] = d1ct[num] + 1 if num in d1ct else 1
	return d1ct

def solve(listn, listm):
	dictn = insert_into_dict(listn)
	dictm = insert_into_dict(listm)
	missing = []
	for (i, v) in dictm.items():
		if dictn[i] < v:
			missing.append(i)
	missing.sort()
	return ' '.join((str(x) for x in missing))
if len(sys.argv) < 2:
	input = sys.stdin
else:
	input = open(sys.argv[1])
input.readline()
listn = [int(x) for x in input.readline().strip().split()]
input.readline()
listm = [int(x) for x in input.readline().strip().split()]
print(solve(listn, listm))


import sys, math, copy
data = sys.stdin.readlines()
na = int(data[0])
a = [int(n) for n in data[1].split()]
nb = int(data[2])
b = [int(n) for n in data[3].split()]
nMissing = nb - na
bmin = min(b)
bmax = max(b)
n = bmin
missing = []
while nMissing and n <= bmax:
	cb = b.count(n)
	if cb:
		ca = a.count(n)
		if ca != cb:
			missing.append(n)
			nMissing -= cb - ca
	n += 1
print(' '.join([str(n) for n in missing]))


N1 = int(input())
d = {}
for x in input().split():
	x = int(x)
	if x in d:
		d[x] = d[x] + 1
	else:
		d[x] = 1
N2 = int(input())
for x in input().split():
	x = int(x)
	d[x] = d[x] - 1
res = []
for x in d.items():
	if x[1] < 0:
		res.append(x[0])
sorted(res)
print(' '.join([str(x) for x in res]))


import collections, sys
N = int(sys.stdin.readline())
A = collections.Counter(map(int, sys.stdin.readline().split()))
M = int(sys.stdin.readline())
B = collections.Counter(map(int, sys.stdin.readline().split()))
print(*sorted((k for k in A if A[k] != B[k])))


from collections import Counter
n = int(input())
nums_a = Counter([int(x) for x in str(input()).split()])
n = int(input())
nums_b = Counter([int(x) for x in str(input()).split()])
result = sorted(nums_b - nums_a)
print(str(result)[1:-1].replace(',', ''))


nA = int(input())
A = input().split()
nB = int(input())
B = input().split()
missing = sorted([x for x in set(B) if A.count(x) < B.count(x)])
print(' '.join((x for x in missing)))


import sys

def solve(a, b):
	d_b = {}
	for elem in b:
		try:
			d_b[elem] += 1
		except KeyError:
			d_b[elem] = 1
	result = []
	for i in range(len(a)):
		d_b[a[i]] -= 1
	for key in d_b:
		if d_b[key] > 0:
			result.append(key)
	return result
a_len = int(input())
a_elems = [int(x) for x in input().split(' ')]
b_len = int(input())
b_elems = [int(x) for x in input().split(' ')]
print(' '.join([str(u) for u in solve(a_elems, b_elems)]))


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
max = b[0]
min = b[0]
for i in b:
	if i > max:
		max = i
	if i < min:
		min = i
nums = [0] * len(set(b))
for i in range(len(b)):
	b[i] -= min
	nums[b[i]] += 1
for i in range(len(a)):
	a[i] -= min
	nums[a[i]] -= 1
out = []
for x in range(len(nums)):
	if nums[x]:
		out.append(str(x + min))
		nums[x] -= 1
print(' '.join(out))


from collections import Counter
n = int(input())
ar_a = Counter(list(map(int, input().split())))
m = int(input())
ar_b = Counter(list(map(int, input().split())))
missing = set()
for key in ar_b:
	if key not in ar_a:
		missing.add(key)
	elif ar_a[key] < ar_b[key]:
		missing.add(key)
print(' '.join(map(str, sorted(missing))))


max1 = int(input())
list1 = list(map(int, input().split()))
max2 = int(input())
list2 = list(map(int, input().split()))
list1.sort()
list2.sort()
minval = list2[0]
countlist = [0] * 101
finalstring = ''
prevval = 0
for i in range(0, max2):
	countlist[list2[i] - minval] += 1
for i in range(0, max1):
	countlist[list1[i] - minval] -= 1
for i in range(0, len(countlist)):
	if countlist[i] > 0:
		finalstring = finalstring + str(i + minval) + ' '
print(finalstring)


counts = {}
for i in range(-10000, 10001):
	counts[i] = 0
n = int(input())
A = map(int, input().split(' '))
m = int(input())
B = map(int, input().split(' '))
for a in A:
	counts[a] -= 1
for b in B:
	counts[b] += 1
diff = []
for i in range(-10000, 10001):
	if counts[i]:
		diff.append(str(i))
print(' '.join(diff))


from collections import Counter

def subtract_lists(a, b):
	count_a = Counter()
	count_b = Counter()
	for x in a:
		count_a[x] += 1
	for x in b:
		count_b[x] += 1
	differences = Counter()
	for x in count_a:
		if count_a[x] > count_b[x]:
			differences[x] = count_a[x] - count_b[x]
	for x in sorted(list(set(differences.elements()))):
		print(x, end=' ')
m = input()
list_b = [int(x) for x in input().split(' ')]
n = input()
list_a = [int(x) for x in input().split(' ')]
subtract_lists(list_a, list_b)


n = int(input())
a = [int(e) for e in input().split()]
m = int(input())
b = [int(e) for e in input().split()]
r = []
mb = min(b)
c = [0 for _ in range(mb, max(b) + 1)]
for e in a:
	c[e - mb] += 1
for e in b:
	c[e - mb] -= 1
for (i, e) in enumerate(c):
	if e < 0:
		r.append(str(i + mb))
print(' '.join(sorted(r)))


n = int(input())
a = sorted(list(map(int, input().strip().split())))
m = input()
b = sorted(list(map(int, input().strip().split())))
missing = set()
k = 0
for i in range(len(b)):
	if k >= n or a[k] != b[i]:
		missing.add(b[i])
	else:
		k += 1
print(' '.join(sorted(list(map(str, missing)))))


n = eval(input())
a = list(map(int, input().split()))
m = eval(input())
b = list(map(int, input().split()))
countlista = [0 for i in range(100)]
countlistb = [0 for i in range(100)]
mi = min(a + b)
for i in range(n):
	countlista[a[i] - mi] += 1
for i in range(m):
	countlistb[b[i] - mi] += 1
out = []
for i in range(100):
	if countlista[i] - countlistb[i]:
		out.append(i + mi)
print(' '.join(map(str, out)))


def main():

	def makelistsameline(strnos):
		return list(map(int, strnos.split()))
	N_a = int(input())
	a = makelistsameline(input())
	N_b = int(input())
	b = makelistsameline(input())
	l_a = len(a)
	l_b = len(b)
	final = []
	if N_a >= N_b:
		(firstlst, secondlst) = (a, b)
	else:
		(firstlst, secondlst) = (b, a)
	net = dict.fromkeys(firstlst, 0)
	for x in firstlst:
		net[x] += 1
	for x in secondlst:
		net[x] -= 1
	for x in net:
		if net[x] == 0 or net[x] == -1:
			continue
		else:
			final.append(x)
	for x in final:
		print(x, end=' ')
main()


input()
l1 = list(map(int, input().split()))
input()
l2 = list(map(int, input().split()))
nbOccur1 = 20001 * [0]
for v in l1:
	nbOccur1[v + 10000] += 1
nbOccur2 = 20001 * [0]
for v in l2:
	nbOccur2[v + 10000] += 1
print(' '.join([str(i - 10000) for i in range(len(nbOccur2)) if nbOccur2[i] > nbOccur1[i]]))


n = int(input())
a = sorted([int(i) for i in input().split()])
m = int(input())
b = sorted([int(i) for i in input().split()])
i = 0
j = 0
ret = []
while i < len(a):
	if a[i] == b[j]:
		j += 1
		i += 1
	elif a[i] > b[j]:
		while a[i] > b[j]:
			ret.append(b[j])
			j += 1
while j < len(b):
	ret.append(b[j])
	j += 1
print(' '.join(map(str, sorted(set(ret)))))


n = int(input())
A = sorted(map(int, input().split()))
m = int(input())
B = sorted(map(int, input().split()))
(ptrA, ptrB) = (0, 0)
lastPrinted = 123456
while ptrB < len(B):
	while ptrB < len(B) and ptrA < len(A) and (B[ptrB] == A[ptrA]):
		if ptrA == len(A) - 1 and ptrB < len(B) - 1 and (B[ptrB + 1] == A[ptrA]):
			if B[ptrB] != lastPrinted:
				print(B[ptrB], end=' ')
				lastPrinted = B[ptrB]
		if ptrA < len(A) - 1:
			ptrA += 1
		ptrB += 1
	while ptrB < len(B) and ptrA < len(A) and (B[ptrB] != A[ptrA]):
		if B[ptrB] != lastPrinted:
			print(B[ptrB], end=' ')
			lastPrinted = B[ptrB]
		ptrB += 1


input()
lst_a = [int(x) for x in input().strip().split(' ')]
input()
lst_b = [int(x) for x in input().strip().split(' ')]
min_elem = min(lst_b)
count_array = [0] * 100
for x in lst_b:
	count_array[x - min_elem] += 1
for x in lst_a:
	count_array[x - min_elem] -= 1
for i in range(len(count_array)):
	if count_array[i] > 0:
		print(i + min_elem, end=' ')
print()


hit = [0] * 200
(minVal, minIndex) = (10000000000, 0)
input()
for i in input().split():
	a = int(i)
	if a < minVal:
		(minVal, minIndex) = (a, a % 200)
	hit[a % 200] -= 1
input()
for i in input().split():
	b = int(i)
	if b < minVal:
		(minVal, minIndex) = (b, b % 200)
	hit[b % 200] += 1

def rec(i):
	val = minVal // 200 * 200 + i
	if val < minVal:
		val += 200
	print('{} '.format(val), end='', flush=True)
[rec(i) for i in range(minIndex, 200) if hit[i] > 0]
[rec(i) for i in range(0, minIndex) if hit[i] > 0]


import collections, sys
N = int(sys.stdin.readline())
A = {}
for a in map(int, sys.stdin.readline().split()):
	if a not in A:
		A[a] = 0
	A[a] += 1
M = int(sys.stdin.readline())
for b in map(int, sys.stdin.readline().split()):
	A[b] -= 1
print(*sorted((k for k in A if A[k])))


count_one = int(input())
list_one = str(input()).split()
count_two = int(input())
list_two = str(input()).split()
union_of_one_two = set(list_one) | set(list_two)
missing_list = []
for item in union_of_one_two:
	if list_one.count(item) != list_two.count(item):
		missing_list.append(int(item))
missing_list.sort()
print(' '.join(map(str, missing_list)))


__author__ = 'danielbaeck'
import math
import itertools
n = input()
a = [int(x) for x in input().split(' ')]
m = input()
b = [int(x) for x in input().split(' ')]
ca = {}
cb = {}
for x in a:
	if not x in ca:
		ca[x] = 0
	ca[x] += 1
missing = []
for x in b:
	if not x in ca or ca[x] == 0:
		missing.append(x)
	ca[x] -= 1
missing = list(set(missing))
missing.sort()
print(' '.join([str(x) for x in missing]))


import collections

def tc(A, B):
	cnt = collections.Counter(B)
	cnt.subtract(A)
	res = sorted([x[0] for x in cnt.items() if x[1] > 0])
	print(' '.join([str(x) for x in res]))
_ = input()
A = [int(x) for x in input().split()]
_ = input()
B = [int(x) for x in input().split()]
tc(A, B)


def findMin(arr):
	m = arr[0]
	for i in arr:
		if i < m:
			m = i
	return m

def findMax(arr):
	m = arr[0]
	for i in arr:
		if i > m:
			m = i
	return m

def countFrequency(arr, minimum, maximum):
	freq = [0 for i in range(101)]
	for i in range(len(arr)):
		freq[arr[i] - minimum] += 1
	return freq
n = int(input().strip())
A = [int(i) for i in input().strip().split(' ')]
m = int(input().strip())
B = [int(i) for i in input().strip().split(' ')]
Bmin = findMin(B)
Bmax = findMax(B)
Afreq = countFrequency(A, Bmin, Bmax)
Bfreq = countFrequency(B, Bmin, Bmax)
ans = []
for i in range(Bmax - Bmin + 1):
	if Bfreq[i] > Afreq[i]:
		ans.append(i + Bmin)
ans.sort()
print(' '.join([str(i) for i in ans]))


input()
A = map(int, input().split())
input()
B = map(int, input().split())
dictA = {}
dictB = {}
for key in A:
	if key in dictA:
		dictA[key] += 1
	else:
		dictA[key] = 1
for key in B:
	if key in dictB:
		dictB[key] += 1
	else:
		dictB[key] = 1
answer = ''
for key in dictA:
	if dictA[key] != dictB[key]:
		answer += str(key) + ' '
print(answer)


def checkn(z):
	if 1 <= z <= 1000010:
		return True

def checkt(z):
	if 1 <= z <= 10000:
		return True

def verifya(x):
	if x[len(x) - 1] - x[0] < 101:
		return True
n = int(input())
if checkn(n):
	ip1 = input().split()
	m = int(input())
	ip2 = input().split()
	if checkn(m):
		l1 = []
		l2 = []
		for i in ip1:
			if i.isdigit() and checkt(int(i)):
				l1.append(int(i))
		for i in ip2:
			if i.isdigit() and checkt(int(i)):
				l2.append(int(i))
		l1.sort()
		l2.sort()
		if verifya(l2) and len(l2) == m and (len(l1) == n):
			d = {}
			for i in l2:
				if i not in d:
					d[i] = 1
				else:
					d[i] += 1
			for i in l1:
				d[i] -= 1
			x = []
			for key in d.keys():
				if d.get(key) > 0:
					x.append(str(key))
			print(' '.join(x))


import collections
input()
a = collections.Counter(map(int, input().split()))
input()
b = collections.Counter(map(int, input().split()))
print(*sorted(b - a))


import fileinput

def read_input():
	f = fileinput.input()
	n = f.readline()
	list_n = f.readline().strip().split(' ')
	m = f.readline()
	list_m = f.readline().strip().split(' ')
	return (list_n, list_m)

def count_list(nums):
	counts = dict()
	for n in nums:
		count = counts[n] if n in counts else 0
		counts[n] = count + 1
	return counts

def main():
	counts_m = dict()
	(list_n, list_m) = read_input()
	counts_m = count_list(list_m)
	for n in list_n:
		count = counts_m[n] - 1
		if count == 0:
			del counts_m[n]
		else:
			counts_m[n] = count
	print(*sorted(counts_m.keys()), sep=' ')
main()


def finder(A, B):
	C = sorted(list(set(B)))
	out = ''
	for i in C:
		if B.count(i) != A.count(i):
			out += str(i) + ' '
	print(out)
n = input()
A = [int(x) for x in input().split()]
m = input()
B = [int(x) for x in input().split()]
finder(A, B)


from sys import stdin

def main():
	n = int(stdin.readline())
	A = list(map(int, stdin.readline().strip().split()))
	m = int(stdin.readline())
	B = list(map(int, stdin.readline().strip().split()))
	get_missing_numbers_simple(n, m, A, B)

def get_missing_numbers_simple(n, m, A, B):
	minB = min(B)
	maxB = max(B)
	numlistA = [0] * (maxB - minB + 1)
	numlistB = [0] * (maxB - minB + 1)
	B = map(subgen(minB), B)
	A = map(subgen(minB), A)
	for item in B:
		numlistB[item] += 1
	for item in A:
		numlistA[item] += 1
	tresult = [x1 - x2 for (x1, x2) in zip(numlistB, numlistA)]
	result = []
	for (i, item) in enumerate(tresult):
		if item:
			result.append(i + minB)
	print(*result)

def subgen(sub):
	return lambda x: x - sub
main()


from collections import deque
sizeA = int(input())
A = list(map(int, input().split()))
sizeB = int(input())
B = list(map(int, input().split()))
MIN = B[0]
counts = deque([1])
for b in B[1:]:
	while b < MIN:
		MIN = MIN - 1
		counts.appendleft(0)
	while b >= MIN + len(counts):
		counts.append(0)
	counts[b - MIN] = counts[b - MIN] + 1
for a in A:
	counts[a - MIN] = counts[a - MIN] - 1
for i in range(len(counts)):
	if counts[i] > 0:
		print(MIN + i, end=' ')


n = int(input())
ais = input().split()
m = int(input())
bis = input().split()
nums = dict()
for bi in bis:
	nums[bi] = nums.get(bi, 0) + 1
for ai in ais:
	nums[ai] -= 1
for k in sorted(nums.keys()):
	if not nums[k]:
		del nums[k]
print(' '.join(sorted(nums.keys())))


N = input()
A = [int(number) for number in input().split()]
M = input()
B = [int(number) for number in input().split()]
B1 = set(B)
for number in sorted(B1):
	count1 = B.count(number)
	count2 = A.count(number)
	if count1 - count2 > 0:
		print(number, end=' ')


firstListCount = eval(input())
firstList = str(input()).split(' ')
secondListCount = eval(input())
secondList = str(input()).split(' ')
missing = []
for i in range(len(secondList)):
	if secondList[i] not in firstList:
		missing.append(secondList[i])
firstListFreq = {}
for i in range(len(firstList)):
	if firstList[i] not in firstListFreq:
		firstListFreq[firstList[i]] = 1
	else:
		firstListFreq[firstList[i]] += 1
secondListFreq = {}
for i in range(len(secondList)):
	if secondList[i] not in secondListFreq:
		secondListFreq[secondList[i]] = 1
	else:
		secondListFreq[secondList[i]] += 1
firstList = set(firstList)
secondList = set(secondList)
for i in firstList:
	if firstListFreq[i] < secondListFreq[i]:
		missing.append(i)
for i in sorted(missing):
	print(i, end=' ')


import sys

def read_num_counts():
	nums = [int(x) for x in sys.stdin.readline().strip().split(' ')]
	num_counts = {}
	for num in nums:
		num_counts[num] = num_counts.get(num, 0) + 1
	return num_counts
sys.stdin.readline()
a_counts = read_num_counts()
sys.stdin.readline()
b_counts = read_num_counts()
missing = []
for (num, b_count) in b_counts.items():
	if a_counts.get(num, 0) != b_count:
		missing.append(num)
print(' '.join([str(n) for n in sorted(missing)]))


from collections import Counter
k1 = input()
c1 = Counter(map(int, input().split()))
k2 = input()
c2 = Counter(map(int, input().split()))
if k1 > k2:
	(c2, c1) = (c1, c2)
l = []
for k in c2.keys():
	if k not in c1 or c1[k] < c2[k]:
		l.append(k)
print(' '.join(map(str, sorted(l))))


input()
s1 = input().split()
input()
s2 = input().split()
s3 = []
for i in set(s1):
	if s1.count(i) < s2.count(i):
		s3.append(i)
for i in sorted(s3):
	print(i, end=' ')