take=lambda:raw_input().strip()
N=int(take())
arr=list(map(int,take().split()))
dic={}
for i in arr:
	if i not in dic:
		dic.update({i:1})
	else:
		dic[i]+=1
ans=[]
for a in dic.keys():
	if dic[a] & 1:
		dic[a]-=1
		ans.append(a)
t=dic.items()
if len(ans)<N:
	t.sort(reverse=True)
	i=0
	while len(ans)<N:
		while  len(ans)<N and t[i][1]>0:
			ans.append(t[i][0])
			t[i]=(t[i][0],t[i][1]-2)
		i+=1
for i in ans:
	print i,