lord-vaders-death-star-2

Darth Vader, the lord of the dark side has created a Death-Star (it can destroy any star). You have to deactivate the Death-star. To deactivate the death-star one must find the unique most powerful Lightsaber.  Lightsaber’s power is associated with a number. You ask for Lightsaber from your friendly Jedis(person).  You should choose the Lightsaber which has the unique power as well as it is  powerful enough.

Input::: 
First line of input contains N,denoting the number of Lightsabers. Next  line contains N  space separated numbers denoting the power(Ai) of each Lightsaber.

Output :::
Print power of the unique most powerful Lightsaber.If there is no such lightsaber present  then print -1. 

Constraints:::
1 ≤ N ≤ 10^6,
0 ≤ Ai ≤ 10^9.

SAMPLE INPUT
5
9 8 8 9 5

SAMPLE OUTPUT
5

Source: hackerearth | Difficulty: EASY


Solutions:
count = int(input())

nos = input().split(" ")

ma = {}

for n in nos:
	n = int(n)
	if((n in ma) == False):
		ma[n] = 1
	else:
		ma[n] += 1

uniqueNos = []

for key in list(ma.keys()):
	if(ma[key] == 1):
		uniqueNos.append(key)

if(len(uniqueNos) == 0):
	print(-1)
else:
	print(max(uniqueNos))

	
	


count = int(input())

nos = input().split(" ")

ma = {}

for n in nos:
	n = int(n)
	if((n in ma) == False):
		ma[n] = 1
	else:
		ma[n] += 1

uniqueNos = []

for key in list(ma.keys()):
	if(ma[key] == 1):
		uniqueNos.append(key)

if(len(uniqueNos) == 0):
	print(-1)
else:
	print(max(uniqueNos))

	
	


from collections import Counter
n=eval(input())
l=list(map(int,input().split()))
c=Counter(l)
flag=[-1]
for key in c:
	if(c[key]==1):
		flag.append(key)

print(max(flag))




	



from collections import Counter
n=eval(input())
l=list(map(int,input().split()))
c=Counter(l)
flag=[-1]
for key in c:
	if(c[key]==1):
		flag.append(key)

print(max(flag))




	



import collections

x=eval(input())
y=list(map(int,input().split()))
y=collections.Counter(y).most_common()
s=[x[0] for x in y if(x[1]==1)]
if(len(s)==0):
	print(-1)
else:
	
	print(max(s))