Given an array a_1, a_2, ..., a_{n} of n integers, find the largest number in the array that is not a perfect square.

A number x is said to be a perfect square if there exists an integer y such that x = y^2.


-----Input-----

The first line contains a single integer n (1 ≤ n ≤ 1000) — the number of elements in the array.

The second line contains n integers a_1, a_2, ..., a_{n} ( - 10^6 ≤ a_{i} ≤ 10^6) — the elements of the array.

It is guaranteed that at least one element of the array is not a perfect square.


-----Output-----

Print the largest number in the array which is not a perfect square. It is guaranteed that an answer always exists.


-----Examples-----
Input
2
4 2

Output
2

Input
8
1 2 4 8 16 32 64 576

Output
32



-----Note-----

In the first sample case, 4 is a perfect square, so the largest number in the array that is not a perfect square is 2.

Difficulty: EASY

Solutions:
import math
t = int(input())
x = input()
a = x.split(' ')
for i in range(t):
	a[i] = int(a[i])
a.sort()
a.reverse()
for i in range(t):
	if a[i] >= 0:
		if pow(math.floor(math.sqrt(a[i])), 2) != float(a[i]):
			print(a[i])
			break
	else:
		print(a[i])
		break


input()
for x in sorted([*map(int, input().split())])[::-1]:
	if x < 0 or int(x ** 0.5) ** 2 != x:
		print(x)
		break


(n, sq) = (int(input()), {i ** 2 for i in range(1001)})
print(max((ai for ai in map(int, input().split()) if ai not in sq)))


input()
a = [int(i) for i in input().split()]
x = -1000000
for i in a:
	if i < 0 or round(i ** 0.5) ** 2 != i:
		x = max(x, i)
print(x)


n = int(input())
a = [int(i) for i in input().split()]
x = -10 ** 7
for i in a:
	if i < 0 or round(i ** 0.5) ** 2 != i:
		x = max(x, i)
print(x)


import math

def is_sqrt(y):
	if y < 0:
		return False
	elif y == 0:
		return True
	x = int(math.sqrt(y))
	return x * x == y
m = -1000001
n = int(input())
ints = list(map(int, input().split()))
for z in ints:
	if not is_sqrt(z) and z > m:
		m = z
print(m)


n = int(input())
data = set(map(int, input().split()))
print(max(data - set([x * x for x in range(1001)])))


n = int(input())
l = list(map(int, input().split()))
lp = []
for i in l:
	if i >= 0:
		if int(i ** 0.5) == float(i ** 0.5):
			pass
		else:
			lp.append(i)
	else:
		lp.append(i)
if len(lp) == 0:
	print(max(l))
else:
	print(max(lp))


import math

def ips(n):
	k = math.sqrt(n)
	return k == math.floor(k)
import sys
t = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
for i in range(t):
	if a[i] >= 0:
		if not ips(a[i]):
			print(a[i])
			break
	else:
		print(a[i])
		break


n = int(input())
A = list(map(int, input().split()))
kk = float('-inf')
for t in A:
	if t > kk and (t < 0 or t ** 0.5 % 1 != 0):
		kk = t
print(kk)


import math
n = int(input())
a = [int(x) for x in input().split()]
x = max([x for x in a if x < 0 or int(math.sqrt(x)) ** 2 != x])
print(x)


from math import sqrt as S

def ps(n):
	return int(S(n)) != S(n)
n = int(input())
l = sorted([int(i) for i in input().split()])
for i in l:
	if i < 0:
		ans = i
	elif ps(i):
		ans = i
print(ans)


def getAns(nums):
	nums = sorted(nums, reverse=True)
	for x in nums:
		if x < 0:
			return x
		temp = x ** (1 / 2)
		if temp - int(temp) != 0:
			return x

def main():
	m = input()
	nums = list(map(lambda x: int(x), input().split(' ')))
	print(getAns(nums))
main()


from math import *
n = int(input())
x = 0
a = []
l = set(map(int, input().split()))
a = set((x ** 2 for x in range(1001)))
print(max(l - a))


input()
ans = []
for i in list(map(int, input().split())):
	if i < 0:
		ans.append(i)
	elif i ** 0.5 % 1 != 0:
		ans.append(i)
print(max(ans))


import math
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
	if a[i] >= 0:
		if math.sqrt(a[i]) != int(math.sqrt(a[i])):
			if ans == 0:
				ans = a[i]
			else:
				ans = max(ans, a[i])
	elif ans == 0:
		ans = a[i]
	else:
		ans = max(ans, a[i])
print(ans)


import math
n = int(input())
L = list(map(int, input().split()))
maxi = -math.inf
for i in range(0, n):
	if L[i] < 0:
		maxi = max(maxi, L[i])
	else:
		x = L[i] ** 0.5
		if int(x) != x:
			maxi = max(maxi, L[i])
print(maxi)


import math
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
for i in range(n):
	if a[i] < 0:
		print(a[i])
		break
	elif a[i] > 0 and math.sqrt(a[i]) != math.floor(math.sqrt(a[i])):
		print(a[i])
		break


import cmath
import math
m = -1111111
q = 0
n = int(input())
b = list(map(int, input().split()))
for i in range(0, n):
	if b[i] < 0:
		if m < b[i]:
			m = b[i]
	else:
		q = math.ceil(math.sqrt(b[i]))
		if q * q != b[i] and b[i] > m:
			m = b[i]
print(m)


n = int(input())
data = list(map(int, input().split()))
squares = [x * x for x in range(1001)]
data.sort(reverse=True)
for num in data:
	if not squares.__contains__(num):
		print(num)
		break


import math

def test(val):
	ret = None
	for i in lst:
		sq = math.sqrt(abs(i))
		sq = sq % 1
		if sq != 0 and ret is None or (0 > i and ret is None):
			ret = i
		elif sq != 0 and i > ret or 0 > i > ret:
			ret = i
	print(ret)
w = input('')
lst = input('').split(' ')
lst = [int(i) for i in lst]
test(lst)


import math
n = int(input())
nums = [int(x) for x in input().split()]
max = -(math.pow(10, 6) + 1)
for i in nums:
	if max < i and i >= 0:
		if math.pow(int(math.sqrt(i)), 2) != i:
			max = i
	elif max < i:
		max = i
print(max)


n = int(input())
nums = list(map(int, input().split()))
biggest = -9999999
for i in range(n):
	x = nums[i]
	if x < 0:
		biggest = max(biggest, x)
	elif int(x ** 0.5) ** 2 != x:
		biggest = max(biggest, x)
print(biggest)


n = int(input())
ar = sorted(list(map(int, input().split())))
mx = -float('inf')
for x in ar:
	if x < 0:
		mx = x
		continue
	el = round(x ** 0.5)
	if el ** 2 != x:
		mx = x
print(mx)


from math import sqrt
n = int(input())
a = list(map(int, input().split()))
maxx = -100000000000000
for i in range(n):
	if a[i] < 0:
		maxx = max(maxx, a[i])
	elif sqrt(a[i]) != int(sqrt(a[i])) and a[i] > maxx:
		maxx = a[i]
print(maxx)


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
mod = 1000000007

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())

def printIn(ob):
	return stdout.write(str(ob) + '\n')

def powerLL(n, p):
	result = 1
	while p:
		if p & 1:
			result = result * n % mod
		p = int(p / 2)
		n = n * n % mod
	return result

def myCode():
	a = I()
	lst1 = L()
	lst1.sort()
	for i in range(a - 1, -1, -1):
		if str(lst1[i] ** 0.5)[-1] == '0':
			continue
		else:
			print(lst1[i])
			exit()

def main():
	myCode()
main()


import math
n = int(input())
arr = sorted(list(map(int, input().split())), reverse=True)
for i in range(len(arr)):
	if arr[i] < 0:
		print(arr[i])
		exit()
	if str(math.sqrt(arr[i]))[-2] != '.':
		print(arr[i])
		exit()


n = int(input())
a = set(map(int, input().split()))
p = set((x * x for x in range(0, 1001)))
print(max(a - p))


try:
	import sys
	n = int(input())
	lis = []
	lis = [int(y) for y in input().split(' ') if int(y) < 0 or ((int(y) ** 0.5).is_integer() == False and int(y) >= 0) for _ in range(n)]
	print(max(lis))
except OSError as err:
	print('OS error: {0}'.format(err))
except ValueError as ex:
	print('Could not convert data to an integer.')
	print('value error: {0}'.format(ex))
except:
	print('Unexpected error:', sys.exc_info()[0])


from math import *
n = int(input())
x = []
z = 0
i = set(map(int, input().split()))
x = set((x ** 2 for x in range(1001)))
print(max(i - x))


from math import *
n = int(input())
l = input().split(' ')
a = -1000000
for i in l:
	if int(i) > a:
		try:
			if int(sqrt(int(i))) != sqrt(int(i)):
				a = int(i)
		except:
			a = int(i)
print(a)


input()
sqrs = set()
x = 0
while x ** 2 <= 10 ** 6:
	sqrs.add(x ** 2)
	x += 1
print(max(filter(lambda x: x not in sqrs, map(int, input().split()))))


res = dict([(i * i, i) for i in range(10000)])
maxi = -100000000
input()
for num in map(int, input().strip().split()):
	if num not in res:
		maxi = max(maxi, num)
print(maxi)


R = lambda : map(int, input().split())
input()
print(max(set(R()) - set((x * x for x in range(1001)))))


import math
n = int(input())
nums = [x for x in map(int, input().split())]
largest = -1

def is_square(apositiveint):
	if apositiveint == 1:
		return True
	if apositiveint == 0:
		return True
	x = apositiveint // 2
	seen = set([x])
	while x * x != apositiveint:
		x = (x + apositiveint // x) // 2
		if x in seen:
			return False
		seen.add(x)
	return True
for i in nums:
	if i >= 0 and i > largest:
		if not is_square(i):
			largest = i
if largest == -1:
	largest = max([x for x in nums if x < 0])
print(largest)


n = int(input())
a = list(map(int, input().split()))
r = int(-1000000.0)
for i in range(n):
	f = 0
	for j in range(1001):
		if j * j == a[i]:
			f = 1
	if f == 0:
		r = max(r, a[i])
print(r)


n = int(input())
arr = sorted([int(x) for x in input().split()])
arr1 = [int(x ** 0.5) == x ** 0.5 if x >= 0 else False for x in arr]
arr1 = arr1[::-1]
print(arr[len(arr) - 1 - arr1.index(False)])


import math
x = int(input())
l = list(map(int, input().split()))
k = {}
for i in l:
	k[i] = abs(i) ** 0.5
f = []
for i in l:
	if i < 0:
		f.append(i)
for i in k.keys():
	if k[i] % 1 == 0:
		pass
	else:
		f.append(i)
print(max(f))


n = int(input())
arr = list(map(int, input().split()))
from math import sqrt

def isnotsquare(x):
	if x < 0:
		return 1
	if sqrt(x) == int(sqrt(x)):
		return 0
	return 1
m = 10 ** 6
dp = -m
for i in arr:
	if isnotsquare(i):
		dp = max(dp, i)
print(dp)


def sqr(x):
	if x == 1:
		return 1
	low = 0
	high = x // 2
	root = high
	while root * root != x:
		root = (low + high) // 2
		if low + 1 >= high:
			return 0
		if root * root > x:
			high = root
		else:
			low = root
	return 1
num = int(input())
arr = list(map(int, input().split()))
arr1 = []
for i in arr:
	if sqr(i) == 0:
		arr1.append(i)
print(max(arr1))


from math import sqrt
input()
a = list(map(int, input().split()))
max = -1000000
for i in a:
	if i >= 0:
		if not sqrt(i).is_integer():
			if i > max:
				max = i
	elif i > max:
		max = i
print(max)


import math
nu = int(input())
list = str(input()).split(' ')
maxV = -1000000
for i in range(len(list)):
	var = int(list[i])
	if (var < 0 or math.sqrt(var) * int(math.sqrt(var))) != var:
		if var > maxV:
			maxV = var
print(maxV)


from math import sqrt
n = input()
n = int(n)
x = input().split(' ')
x = [int(i) for i in x]
x.sort()
for i in reversed(range(0, n)):
	if x[i] < 0:
		print(x[i])
		break
	z = int(sqrt(x[i]))
	if z * z != x[i]:
		print(x[i])
		break


n = int(input())
a = [int(i) for i in input().split()]
ans = 0
a.sort(reverse=True)
for i in a:
	if i >= 0:
		if i ** 0.5 != int(i ** 0.5):
			print(i)
			break
	else:
		print(i)
		break


from math import floor, sqrt
n = int(input())
lst = []
for x in input().split():
	lst.append(int(x))
max_n = -10 ** 6 - 1
for x in lst:
	if x >= 0:
		p = floor(sqrt(x))
		if p ** 2 != x:
			max_n = max(max_n, x)
	else:
		max_n = max(max_n, x)
print(max_n)


def solve():
	n = int(input())
	al = set([int(i) for i in input().split()])
	for i in range(1001):
		al = al - set([i * i])
	print(max(al))

def __starting_point():
	solve()
__starting_point()


n = int(input())
numbers = list(map(int, input().strip().split()))
res = -10000000
for i in numbers:
	if i >= 0:
		tmp = i ** 0.5
		if tmp != int(tmp):
			res = max(res, i)
	else:
		res = max(res, i)
print(res)


import math

def isPerfectSquare(n):
	if n < 0:
		return False
	x = int(math.sqrt(n))
	return n == x * x

def main():
	n = int(input())
	a = [int(i) for i in input().split()]
	a.sort()
	for i in range(n - 1, -1, -1):
		if not isPerfectSquare(a[i]):
			print(a[i])
			return
main()


from math import *
n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
for i in l:
	if i > 0 and sqrt(i) != int(sqrt(i)):
		print(i)
		exit()
for i in l:
	if i < 0:
		print(i)
		exit()


n = int(input())
s = set(map(int, input().split()))
l = set([i * i for i in range(1001)])
print(max(s.difference(l)))


n = int(input())
a = list(map(int, input().split()))
o = -4375687432
for i in a:
	if i < 0 or int(i ** 0.5) ** 2 != i:
		o = max(o, i)
print(o)


import math
n = int(input())
nums = list(map(int, input().split()))
best = float('-inf')
for v in nums:
	good = True
	for i in range(1002):
		if i ** 2 == v:
			good = False
			break
	if good:
		best = max(best, v)
print(best)


n = list(map(int, input().strip().split()))
arr = list(map(int, input().strip().split()))
answer = -9999999
for i in arr:
	if i < 0:
		answer = max(answer, i)
		continue
	temp = int(i ** (1 / 2))
	if (temp - 1) ** 2 == i or temp ** 2 == i or (temp + 1) ** 2 == i:
		continue
	answer = max(answer, i)
print(answer)


import math
ans = -1000000
n = int(input())
nums = [int(x) for x in input().split()]
for num in nums:
	if num < 0:
		ans = max(ans, num)
	else:
		sq = math.sqrt(num)
		if int(sq) != sq:
			ans = max(ans, num)
print(ans)


def bisearch(f, n):
	l = 0
	r = n
	fl = f(l)
	fr = f(r)
	while l <= r:
		m = (l + r) // 2
		fm = f(m)
		if fm == n:
			return m
		elif fm > n:
			r = m - 1
			fr = f(r)
		else:
			l = m + 1
			fl = f(l)

def try_square_root(n2):
	return bisearch(lambda n: n * n, n2)
N = int(input())
A = input().split()
for i in range(N):
	A[i] = int(A[i])
A.sort(reverse=True)
for i in range(N):
	if try_square_root(A[i]) == None:
		print(A[i])
		quit()


from math import *
n = int(input())
a = [n] * 0
a = [int(x) for x in input().split()]
a = sorted(a, reverse=True)
if a[0] < 0:
	print(a[0])
else:
	for x in range(0, n):
		if a[x] < 0:
			print(a[x])
			break
		else:
			r = pow(a[x], 0.5)
			if r != int(r):
				print(a[x])
				break


z = input
mod = 10 ** 9 + 7
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)
n = int(z())
l = sorted(list(map(int, z().split())))[::-1]
for i in l:
	t = i
	if i < 0:
		i = i * -1
		print(t)
		exit()
	if int(i ** 0.5) != i ** 0.5:
		print(t)
		exit(0)


n = int(input())
arr = [int(x) for x in input().split(' ')]
arr.sort(reverse=True)
i = 0
for i in range(n):
	if arr[i] < 0:
		break
	x = arr[i] ** (1 / 2.0)
	y = x - int(x)
	if y > 0:
		break
print(arr[i])


import math
N = int(input())
A = [int(x) for x in input().split()]
A = sorted(A, reverse=True)
perfects = set([x ** 2 for x in range(0, math.ceil(math.sqrt(10 ** 6)) + 1)])
for a in A:
	if a not in perfects:
		print(a)
		break


import math
n = int(input())
l = [int(x) for x in input().split()]
while 1:
	x = max(l)
	if x >= 0:
		y = int(math.sqrt(x))
		if y ** 2 == x:
			del l[l.index(x)]
		else:
			print(x)
			break
	else:
		print(x)
		break


n = int(input())
x = list(map(int, input().split()))
x.sort()
maxi = x[0]
for i in range(n):
	if x[i] > 0 and x[i] != 1:
		p = x[i] ** 0.5
		p = int(p)
		if p ** 2 != x[i]:
			maxi = x[i]
	if x[i] < 0:
		maxi = x[i]
print(maxi)


zn = int(input())
print(max((x for x in map(int, input().split()) if x not in set((x * x for x in range(1001))))))


from math import *

def is_it_square(x):
	if x < 0:
		return False
	return floor(sqrt(x)) ** 2 == x
n = int(input())
l = [int(x) for x in input().split()]
l.sort()
l.reverse()
for x in l:
	if is_it_square(x):
		continue
	print(x)
	return


f = int(input())
a = list(map(int, input().split()))
b = []
c = []
n = 0
k = 0
for i in range(len(a)):
	k = a[i] ** (1 / 2)
	if a[i] > n and k % 1 != 0:
		n = a[i]
for i in range(len(a)):
	if a[i] > 0:
		b.append(a[i])
	elif a[i] < 0:
		c.append(a[i])
if n != 0:
	print(n)
else:
	print(max(c))


import math
n = int(input())
list_n = list(map(int, input().split()))
not_pefect = []
for item in list_n:
	if item >= 0:
		temp = math.sqrt(item)
		if int(temp) == math.ceil(temp) == math.floor(temp):
			pass
		else:
			not_pefect.append(item)
	else:
		not_pefect.append(item)
print(max(not_pefect))


n = int(input())
xx = [int(i) for i in input().split()]
ans = -100000000.0
for i in xx:
	if i < 0:
		ans = max(ans, i)
		continue
	x = int(i ** 0.5)
	if x ** 2 != i and (x - 1) ** 2 != i and ((x + 1) ** 2 != i):
		ans = max(ans, i)
print(ans)


import math
import sys

def scan():
	return list(map(int, sys.stdin.readline().strip().split()))

def solution():
	n = int(input())
	a = scan()
	a.sort()
	m = 0
	for i in a:
		if i < 0:
			m = i
			continue
		d = math.sqrt(i)
		if d != int(d):
			m = i
	print(m)
solution()


import math
n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
ans = []
for i in range(n):
	if a[i] >= 0:
		if int(math.sqrt(a[i])) != math.sqrt(a[i]):
			ans.append(a[i])
			break
	else:
		ans.append(a[i])
print(max(ans))


n = int(input())
l = sorted(list(map(int, input().split())), reverse=True)
for i in range(n):
	x = int(pow(abs(l[i]), 0.5))
	if x ** 2 != l[i]:
		print(l[i])
		exit()


n = int(input())
l = sorted(list(map(int, input().split())))
for x in range(n):
	if l[-x - 1] < 0:
		print(l[-x - 1])
		break
	elif l[-x - 1] ** 0.5 != int(l[-x - 1] ** 0.5):
		print(l[-x - 1])
		break


from math import sqrt, floor
n = int(input())
a = [int(i) for i in input().split()]
max = 0
a.sort()
for i in range(n):
	if a[i] > 0:
		if sqrt(a[i]) % floor(sqrt(a[i])) != 0:
			if a[i] > max:
				max = a[i]
	elif a[i] < 0:
		if i == 0:
			max = a[i]
		elif a[i] > max:
			max = a[i]
print(max)


from sys import stdin, stdout
n = int(stdin.readline())
values = sorted(list(map(int, stdin.readline().split())))
ans = min(values)
for i in range(n):
	if values[i] >= 0:
		x = values[i] ** 0.5
		if int(x) != x:
			ans = max(ans, values[i])
	else:
		ans = values[i]
stdout.write(str(ans))


import math

def square(n):
	ok = False
	ans = math.sqrt(n)
	if ans - math.floor(ans) == 0:
		ok = True
	if ok:
		return True
	else:
		return False
n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
ok = False
for i in range(len(a)):
	if a[i] >= 0:
		if square(a[i]) == False:
			ok = True
			tmp = a[i]
			break
if ok:
	print(tmp)
else:
	for i in a:
		if i < 0:
			print(i)
			break


import math
n = int(input())
p = list(map(int, input().split()))

def s(n, p):
	if n == 1:
		print(p[0])
		return
	elif max(p) < 0:
		print(max(p))
		return
	while math.sqrt(max(p)) == int(math.sqrt(max(p))):
		p.remove(max(p))
		if max(p) < 0:
			print(max(p))
			return
	print(max(p))
s(n, p)


import math
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
ans = -1
for i in range(n):
	if a[i] < 0:
		ans = a[i]
		break
	if math.sqrt(a[i]) % 1:
		ans = a[i]
		break
print(ans)


from math import *
t = int(input())
a = list(map(int, input().split()))
sum = -10000000
for i in range(len(a)):
	if a[i] < 0:
		if a[i] > sum:
			sum = a[i]
	elif a[i] > 0:
		if sqrt(a[i]).is_integer() == False:
			if a[i] > sum:
				sum = a[i]
print(sum)


n = int(input())
li = list(map(int, input().split()))
ans = -9999999999999999
for i in li:
	if i < 0:
		ans = max(ans, i)
		continue
	if int(i ** 0.5) ** 2 != i:
		ans = max(ans, i)
print(ans)


n = input()
l = list(map(int, input().split()))
j = []
for i in l:
	if i < 0:
		j.append(i)
	elif int(i ** 0.5) ** 2 != i:
		j.append(i)
j.sort()
print(j[len(j) - 1])


from math import sqrt, floor
num_elements = int(input())
num_inputs = input().split()
not_perfect_square = -10 ** 7
for val in num_inputs:
	val = int(val)
	if val >= 0:
		val_sqrt = sqrt(val)
		if floor(val_sqrt) == val_sqrt:
			continue
	if val > not_perfect_square:
		not_perfect_square = val
print(not_perfect_square)


def f(l):
	sl = [i * i for i in range(1000, -1, -1)]
	l.sort()
	n = len(l)
	j = 0
	for i in range(n - 1, -1, -1):
		while sl[j] > l[i]:
			j += 1
			if j >= 1001:
				return l[i]
		if sl[j] < l[i]:
			return l[i]
_ = input()
l = list(map(int, input().split()))
print(f(l))


from math import *
num = []
words = []
nums = []
i = int(input()) - 1
str = input().split()
while i >= 0:
	words.append(str[i])
	i -= 1
for m in words:
	nums.append(int(m))
for i in nums:
	if i < 0:
		num.append(i)
	elif not sqrt(i).is_integer():
		num.append(i)
l = max(num)
print(l)


n = int(input())
a = list(map(int, input().split()))
maxx = -1000000000000.0
for i in a:
	if i < 0:
		maxx = max(maxx, i)
	else:
		x = int(pow(i, 0.5))
		if x ** 2 == i:
			continue
		else:
			maxx = max(maxx, i)
print(maxx)


import math
n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
for i in l:
	if i >= 0:
		p = int(math.sqrt(i))
		if p * p != i:
			print(i)
			break
	else:
		print(i)
		break


import math

def func(numbers):
	for i in numbers:
		if i < 0 or math.sqrt(abs(i)) % 1 != 0.0:
			return i
n = int(input())
numbers = list(map(int, input().split()))
numbers.sort(reverse=True)
print(func(numbers))


_ = input()
l = list(map(int, input().split()))
ans = []
for i in l:
	if i < 0 or round(i ** (1 / 2)) ** 2 != i:
		ans.append(i)
ans.sort()
print(ans[-1])


x = int(input())
n = [int(i) for i in input().split()]
m = []

def isSqr(N):
	temp = 0
	if N < 0:
		return False
	temp = int(int(N ** (1 / 2)) ** 2)
	if temp == N:
		return True
	return False
for i in n:
	if not isSqr(i):
		m.append(i)
print(max(m))


import math
n = int(input())
s = list(map(int, input().split()))
s.sort(reverse=True)
for el in s:
	if el < 0 or int(math.sqrt(el)) != math.sqrt(el):
		print(el)
		break


import math
n = int(input())
a = list(map(int, input().split()))
t = [i for i in a if i < 0]
m = 0
if len(t) > 0:
	m = max(t)
for j in [i for i in a if i > 0]:
	k = int(math.sqrt(j))
	if k * k != j and m < j:
		m = j
print(m)


a = int(input())
b = [int(x) for x in input().split()]
b.sort()
for i in range(a - 1, -1, -1):
	if b[i] < 0:
		print(b[i])
		break
	elif b[i] ** (1 / 2) != b[i] ** (1 / 2) // 1:
		print(b[i])
		break


def isp(n):
	if n < 0:
		return False
	c = n ** 0.5
	if c % 1 == 0:
		return True
	else:
		return False
n = int(input())
s = input()
a = s.split()
for i in range(len(a)):
	a[i] = int(a[i])
while isp(max(a)) == True:
	x = a.index(max(a))
	del a[x]
print(max(a))


from math import *
n = int(input())
a = list(map(int, input().split()))
max1 = -float('inf')
for i in range(n):
	if a[i] < 0 or ceil(sqrt(a[i])) != int(sqrt(a[i])):
		if a[i] > max1:
			max1 = a[i]
print(max1)


import math
n = int(input())
a = [int(i) for i in input().split()]
a = reversed(sorted(a))

def check(k):
	return int(math.sqrt(k)) ** 2 == k
for i in a:
	if i < 0:
		print(i)
		exit()
	if not check(i):
		print(i)
		exit()


import sys
n = int(sys.stdin.readline())
l = [int(elem) for elem in sys.stdin.readline().split()]

def is_not_square(apositiveint):
	if apositiveint < 0:
		return True
	if apositiveint == 1:
		return False
	if apositiveint == 0:
		return False
	x = apositiveint // 2
	seen = set([x])
	while x * x != apositiveint:
		x = (x + apositiveint // x) // 2
		if x in seen:
			return True
		seen.add(x)
	return False
print(max(filter(is_not_square, l)))


from math import sqrt
n = int(input())
a = []
a = input().split()
a = [int(i) for i in a]
a.sort()
for i in range(n - 1, -1, -1):
	if a[i] < 0:
		print(a[i])
		break
	if int(sqrt(a[i])) ** 2 != a[i]:
		print(a[i])
		break


input()
sqrs = set()
x = 0
while x ** 2 <= 10 ** 6:
	sqrs.add(x ** 2)
	x += 1
print(max([x for x in map(int, input().split()) if x not in sqrs]))


import sys
inf = float('inf')
from math import ceil, floor, log, sqrt, factorial, pow, pi, gcd
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
(mod, MOD) = (1000000007, 998244353)
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
n = int(input())
Arr = get_array()
Arr.sort()
maxi = -1
for i in range(n - 1, -1, -1):
	if Arr[i] >= 0:
		z = sqrt(Arr[i])
		if z != floor(z):
			print(Arr[i])
			break
	else:
		print(Arr[i])
		break


s = set()
x = 0
while x * x <= 1000000:
	s.add(x * x)
	x += 1
n = int(input())
a = list(map(int, input().split()))
mx = -10000000000
for x in a:
	if x not in s and mx < x:
		mx = x
print(mx)


n = int(input())
arr = sorted(map(int, input().split()), reverse=True)
num = 0
num2 = 0
squares = []
while num2 <= 10 ** 6:
	squares.append(num2)
	num += 1
	num2 = num ** 2
perfs = set(squares)
for inp_num in arr:
	if inp_num not in perfs:
		print(inp_num)
		break


def read():
	return list(map(int, input().split()))
b = []
i = 0
while i * i <= 1000000:
	b.append(i * i)
	i += 1
n = int(input())
a = read()
ans = []
for i in a:
	if not i in b:
		ans.append(i)
print(max(ans))


import math
EPS = 1e-09
n = int(input())
s = input()
a = map(int, s.split())
max_not_square = -1000000.0 - 1
for x in a:
	if x >= 0:
		root = math.sqrt(float(x))
		if abs(root - int(root)) >= EPS and x > max_not_square:
			max_not_square = x
	elif x > max_not_square:
		max_not_square = x
print(max_not_square)


import math
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
for i in a:
	if i < 0:
		print(i)
		break
	sa = math.sqrt(i)
	if int(sa) != sa:
		print(i)
		break


import math
n = int(input())
l = list(map(int, input().strip().split(' ')))
l = sorted(l, reverse=True)
for i in range(n):
	if l[i] < 0 or math.floor(math.sqrt(l[i])) != math.ceil(math.sqrt(l[i])):
		print(l[i])
		break


from math import sqrt

def isSquare(n):
	if n < 0:
		return False
	m = int(sqrt(n))
	for i in range(0, m + 1):
		if n == i * i:
			return True
	return False
read = lambda : map(int, input().split())
n = read()
a = sorted(list(read()), reverse=True)
for x in a:
	if not isSquare(x):
		print(x)
		exit()
print(-1)


n = int(input())
a = list(map(int, input().split()))
a.sort()
t = 0
i = n - 1
while i >= 0:
	if a[i] < 0:
		print(a[i])
		break
	if a[i] == 0:
		i -= 1
		continue
	t = a[i] ** 0.5
	if a[i] % t != 0:
		print(a[i])
		break
	i -= 1


import math
n = int(input())
l = list(map(int, input().split()))

def notsquare(x):
	if x >= 0:
		m = math.sqrt(x)
		if m == int(m):
			return False
		return True
	return True
print(max(filter(notsquare, l)))


n = int(input())
nums = list(map(int, input().split()))
nums.sort(reverse=True)
for i in range(n):
	if nums[i] < 0:
		print(nums[i])
		exit(0)
	sq = nums[i] ** 0.5
	if int(sq) ** 2 != nums[i]:
		print(nums[i])
		exit(0)


def is_not_sq(n):
	if n >= 0 and n == int(n ** 0.5) ** 2:
		return False
	return True

def main():
	n = input()
	numbers = map(int, input().split())
	return max(filter(is_not_sq, numbers))
print(main())


import math
n = input()
a = input().split()
best = None
for x in a:
	y = int(x)
	pretendent = None
	if y < 0:
		pretendent = y
	elif math.pow(math.floor(math.sqrt(y)), 2) != y:
		pretendent = y
	if pretendent is not None:
		if best is None:
			best = pretendent
		elif pretendent > best:
			best = pretendent
print(best)


a = -10 ** 7
ans = a
le = int(input())
d = list(map(int, input().split()))
for i in d:
	j = 0
	while j * j <= i:
		if j * j == i:
			i = a
		j += 1
	ans = max(ans, i)
print(ans)


n = int(input())
A = list(map(int, input().split()))
ans = -10 ** 6 - 7
for i in A:
	if i >= 0:
		num = i ** 0.5
		if num != int(num) and i > ans:
			ans = i
	elif i > ans:
		ans = i
print(ans)


n = int(input())
inp = lambda : map(int, input().split())
a = list(inp())
m = -10 ** 10
for i in range(n):
	if a[i] < 0:
		m = max(m, a[i])
	else:
		x = round(a[i] ** 0.5)
		if x * x != a[i]:
			m = max(m, a[i])
print(m)


import math
n = int(input(''))
arr = list(map(int, input().split()))
arr.sort(reverse=True)
for i in arr:
	if i < 0 or math.sqrt(i) != int(math.sqrt(i)):
		print(i)
		break


from math import sqrt
n = int(input())
ans = -1000000000.0
z = list(map(int, input().split()))
for t in z:
	if t < 0:
		ans = max(t, ans)
	else:
		p = int(sqrt(t))
		while (p + 1) * (p + 1) <= t:
			p += 1
		while p * p > t:
			p -= 1
		if p * p != t:
			ans = max(ans, t)
print(ans)


n = int(input())
all_a = list(map(int, input().split()))
a = sorted([x for x in all_a if x >= 0])
pos = 0
i = 0
neg = [x for x in all_a if x < 0]
max_not_square = max(neg) if neg else None
while pos < len(a):
	while i * i < a[pos]:
		i += 1
	if i * i > a[pos]:
		max_not_square = a[pos]
	pos += 1
print(max_not_square)


x = int(input())
a = list(map(int, input().split()))
k = float('-inf')
for i in range(x):
	if a[i] < 0:
		k = max(k, a[i])
		t = 1
	elif a[i] ** (1 / 2) != int(a[i] ** (1 / 2)):
		k = max(k, a[i])
print(k)


from math import *
n = int(input(''))
while 1:
	ch = input('')
	l = ch.split()
	if len(l) == n:
		break
c = -1000000
for i in range(0, n):
	if int(l[i]) < 0:
		m = int(l[i])
		if m > c:
			c = m
	elif sqrt(int(l[i])) != trunc(sqrt(int(l[i]))):
		m = int(l[i])
		if c < m:
			c = m
print(c)


from math import sqrt
n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
for i in a:
	if i < 0:
		print(i)
		quit()
	b = sqrt(i)
	if int(b) != b:
		print(i)
		quit()


import math
n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
if l[0] < 0:
	print(l[0])
else:
	index = 0
	for i in range(0, len(l)):
		if l[i] >= 0 and math.ceil(l[i] ** 0.5) != math.floor(l[i] ** 0.5):
			index = i
			break
		elif l[i] < 0:
			index = i
			break
	print(l[index])


import math

def sqr(v):
	return v * v

def is_square(v):
	if v == 0:
		return True
	if v < 0:
		return False
	y = int(math.sqrt(v))
	if sqr(y) == v:
		return True
	if y > 1 and sqr(y - 1) == v:
		return True
	if sqr(y + 1) == v:
		return True
	return False
n = int(input())
a = map(int, input().split())
best = -10 ** 9
for v in a:
	if not is_square(v) and v > best:
		best = v
print(best)


input()
arr = list(map(int, input().split()))
import math
b = -1000
arr.sort()
for i in range(len(arr) - 1, -1, -1):
	if arr[i] < 0:
		print(arr[i])
		exit(0)
	a = int(math.sqrt(arr[i]))
	if a * a != arr[i]:
		print(arr[i])
		exit(0)


a = input()
b = [int(i) for i in input().split()]
b.sort(reverse=True)
for i in b:
	if i < 0:
		print(i)
		break
	elif i ** (1 / 2) != int(i ** (1 / 2)):
		print(i)
		break


import math

def Main():
	n = int(input())
	square = list(filter(lambda x: not (x >= 0 and math.floor(math.sqrt(x)) == math.sqrt(x)), map(int, input().split())))
	return max(square)
print(Main())


def ps(n):
	return n ** 0.5 == int(n ** 0.5)
n = int(input().strip())
ar = [int(i) for i in input().strip().split()]
ar.sort(reverse=True)
for i in ar:
	if i < 0 or not ps(i):
		print(i)
		break


import math

def not_perfect(x):
	try:
		return int(math.sqrt(x)) ** 2 == x
	except:
		return False
_ = input()
lst = [int(x) for x in input().split()]
bad = filter(not_perfect, lst)
print(max(set(lst) - set(bad)))


from sys import stdin, stdout
import bisect
import math
from collections import Counter

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
			n = n - 1
		else:
			a = a * a
			n = n >> 1
	return r

def solve():
	n = inp()
	l = li()
	x = []
	for i in l:
		if i > 0:
			if i ** 0.5 != math.floor(i ** 0.5):
				x.append(i)
		elif i < 0:
			x.append(i)
	pr(max(x))
for _ in range(1):
	solve()


from sys import stdin
n = int(stdin.readline().strip())
s = list(map(int, stdin.readline().strip().split()))
ans = -10 ** 8
for i in s:
	if i < 0 or int(i ** 0.5) ** 2 != i:
		ans = max(ans, i)
print(ans)


sq = {i * i for i in range(0, 10000)}
n = int(input())
A = [int(x) for x in input().split()]
B = [a for a in A if a not in sq]
print(max(B))


n = int(input())
ls = list(map(int, input().split()))
ls.sort()
ls.reverse()
for i in ls:
	if i < 0:
		print(i)
		exit()
	foo = i ** 0.5
	if int(foo) ** 2 != i:
		print(i)
		exit()


from math import *
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	for j in range(i, n):
		if a[j] < a[j - 1]:
			(a[j], a[j - 1]) = (a[j - 1], a[j])
for i in range(n - 1, -1, -1):
	if a[i] >= 0:
		if sqrt(a[i]) % 1 != 0:
			print(a[i])
			break
	else:
		print(a[i])
		break


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 15
mod = 10 ** 9 + 7

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	a = sorted(LI(), reverse=True)
	for c in a:
		if c < 0:
			return c
		t = int(c ** 0.5)
		f = True
		for tt in range(t - 2, t + 3):
			if c == tt ** 2:
				f = False
				break
		if f:
			return c
	return -1
print(main())


n = int(input())
s = list(map(int, input().split()))
s = sorted(s, reverse=True)
for i in s:
	if i < 0:
		continue
	if i ** 0.5 != int(i ** 0.5):
		print(i)
		exit()
for i in s:
	if i < 0:
		print(i)
		exit()


import math
n = int(input())
a = sorted(list(map(int, input().split())))
max1 = -999999
for i in a:
	if i < 0:
		max1 = i
	elif int(math.sqrt(i)) != math.sqrt(i):
		max1 = i
print(max1)


def square(x):
	for i in range(1111):
		if i * i == x:
			return True
	return False
n = int(input())
a = [int(x) for x in input().split()]
print(max((x for x in a if not square(x))))


n = int(input())
ls = list(map(int, input().split()))
ls.sort()
x = 0
dic = dict()
for i in ls:
	dic[i] = 1
for i in range(n - 1, -1, -1):
	temp = ls[i] ** 0.5
	if ls[i] < 0:
		print(ls[i])
		break
	if temp != int(temp):
		print(ls[i])
		break
	else:
		try:
			if dic[ls[i]] == 1:
				pass
		except:
			print(ls[i])
			break


from math import sqrt

def check(n):
	d = int(sqrt(n))
	if d * d == n:
		return True
	return False

def lnps(a, n):
	maxi = -9999999
	for i in range(0, n):
		if a[i] < 0:
			maxi = max(a[i], maxi)
		elif check(a[i]) == False and a[i] >= 0:
			maxi = max(a[i], maxi)
	return maxi
n = int(input())
a = list(map(int, input('').split()))
print(lnps(a, n))


s = set()
for i in range(1001):
	s.add(i * i)
n = input()
xs = [int(x) for x in input().split()]
print(max((x for x in xs if x not in s)))


n = int(input())
arr = list(map(int, input().split(' ')))
l = []
for i in range(0, n):
	if arr[i] >= 0:
		x = int(arr[i] ** 0.5)
		if arr[i] != x * x:
			l.append(arr[i])
	else:
		l.append(arr[i])
print(max(l))


from math import sqrt
n = int(input())
a = input().split()
for i in range(n):
	a[i] = int(a[i])
while max(a) >= 0 and sqrt(max(a)) == round(sqrt(max(a))):
	a.remove(max(a))
print(max(a))


n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
for k in a:
	s = k
	if s < 0:
		print(s)
		break
	if s != int(k ** 0.5) ** 2:
		print(s)
		break


import math
n = int(input())
a = input().split()
for i in range(n):
	a[i] = int(a[i])
k = -1000001
for i in a:
	if i > k:
		if i < 0:
			k = i
		else:
			p = math.sqrt(i)
			if math.floor(p) != p:
				k = i
print(k)


n = int(input())
import math
arr = list(map(int, input().split()))
arr.sort(reverse=True)
for i in arr:
	x = round(math.sqrt(abs(i)))
	if x * x != i:
		print(i)
		break


n = int(input())
arr = [int(i) for i in input().split()]
ans = -1000000000000
for x in arr:
	t = 0
	while t * t < x:
		t += 1
	if t * t != x:
		ans = max(ans, x)
print(ans)


n = int(input())
a = list(map(int, input().strip().split(' ')))
ans = -10000000
for i in a:
	if i < 0:
		if i > ans:
			ans = i
	elif int(i ** 0.5) ** 2 != i and i > ans:
		ans = i
print(ans)


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
a.reverse()
for i in a:
	if i < 0:
		print(i)
		return
	if int(i ** 0.5) ** 2 != i:
		print(i)
		return


n = int(input())
b = [int(i ** 2) for i in range(1001)]
a = sorted(list(map(int, input().split())))
for i in range(n - 1, -1, -1):
	if a[i] not in b:
		print(a[i])
		break


import math
n = int(input())
h = 0
m = map(int, input().split())
for a in m:
	if not h and a < 0:
		h = a
	elif h < a < 0:
		h = a
	elif a > 0 and h < a and (not math.sqrt(a).is_integer()):
		h = a
print(h)


import math

class CodeforcesTask914ASolution:

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

	def read_input(self):
		self.n = int(input())
		self.array = [int(x) for x in input().split(' ')]

	def process_task(self):
		not_perfect_square = [x for x in [y for y in self.array if y >= 0] if not math.sqrt(x).is_integer()]
		not_perfect_square += [y for y in self.array if y < 0]
		not_perfect_square.sort(reverse=True)
		self.result = str(not_perfect_square[0])

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


import math
n = int(input())
a = list(map(int, input().split()))
a.sort()
i = n - 1
while 1:
	if a[i] < 0 or math.sqrt(a[i]) != int(math.sqrt(a[i])):
		print(a[i])
		break
	i -= 1


n = int(input())
a = list(map(int, input().split()))
r = max(filter(lambda x: x < 0, a + [-1000001]))
for t in filter(lambda x: x > 0, a):
	if pow(int(t ** 0.5), 2) != t:
		r = max(r, t)
print(r)


import sys
from math import *
input = sys.stdin.buffer.readline
n = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
for x in arr:
	if x < 0:
		print(x)
		break
	else:
		x = int(fabs(x))
		c = int(sqrt(x))
		if c * c != x:
			print(x)
			break


import math
input()
arr = list(map(int, input().split()))
p_squares = []

def is_psquare(n):
	if n < 0:
		return True
	sqr = math.sqrt(n)
	if sqr == math.floor(sqr):
		return False
	return True
for x in arr:
	if is_psquare(x):
		p_squares.append(x)
print(max(p_squares))


import math
import sys
n = input()
arr = input().split()
res = -sys.maxsize
for p in arr:
	p = int(p)
	if p > res and (p < 0 or math.sqrt(p) % 1 != 0):
		res = p
print(res)


n = int(input())
print(max(set(map(int, input().split())) - set((x * x for x in range(1100)))))


from math import sqrt
x = int(input())
ans = -1 * 10 ** 6
l = [int(i) for i in input().split()]
for i in l:
	if i < 0:
		ans = max(ans, i)
	else:
		d = int(sqrt(i))
		if d * d != i:
			ans = max(ans, i)
print(ans)


n = int(input())
print(max(set(list(map(int, input().split()))) - set((i * i for i in range(1002)))))


a = int(input())
b = input()
b = b.split(' ')
s = []
for i in range(len(b)):
	if int(b[i]) >= 0:
		b[i] = int(b[i])
		f = b[i]
		b[i] = b[i] ** 0.5
		if b[i] != int(b[i]):
			b[i] = int(b[i])
			s.append(f)
	else:
		s.append(int(b[i]))
print(max(s))


from sys import stdin as si
from collections import Counter as c

class Solution:

	def checkSquare(self, x):
		return x ** 0.5 % 1 == 0

	def bazinga(self, b):
		b.sort()
		for i in b[::-1]:
			if i < 0:
				return i
			if not self.checkSquare(i):
				return i
n = si.readline().strip()
m = list(map(int, si.readline().strip().split()))
S = Solution()
print(S.bazinga(m))


from math import sqrt
n = int(input())
l = list(map(int, input().split()))
lneg = list(filter(lambda x: x < 0, l))
lpos = list(filter(lambda x: int(sqrt(x)) ** 2 != x, list(filter(lambda x: x >= 0, l))))
try:
	lp = max(lpos)
except:
	lp = max(lneg)
try:
	ln = max(lneg)
except:
	ln = max(lpos)
print(max([lp, ln]))


import math
n = int(input())
a = list(map(int, input().split()))
a.sort()
for elem in a[::-1]:
	if elem >= 0:
		if math.sqrt(elem) != math.ceil(math.sqrt(elem)):
			print(elem)
			break
	else:
		print(elem)
		break


def check(k):
	i = 0
	while i * i < k:
		i += 1
	if i * i == k:
		return True
	else:
		return False
n = int(input())
a = list(input().split(' '))
b = list((int(x) for x in a))
res = -10 * int(10000000.0)
for i in range(n):
	if check(b[i]) == False and b[i] > res:
		res = b[i]
print(res)


import math
(length, ints, maximum) = (int(input()), sorted(list(map(float, input().split(' ')))), -10 ** 7)
for val in ints:
	if val > maximum and (val < 0 or math.sqrt(val) != int(math.sqrt(val))):
		maximum = val
print(int(maximum))


import math

def is_sq(num):
	if num < 0:
		return False
	sq = int(math.sqrt(num))
	return sq * sq == num
number = int(input())
a = list(map(int, input().split()))
b = [n for n in a if not is_sq(n)]
print(max(b))


n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
	if a[i] < 0:
		b.append(a[i])
	else:
		x = pow(a[i], 0.5)
		if x - int(x) != 0:
			b.append(a[i])
print(max(b))


n = int(input())
mx = -1000000000
for el in list(map(int, input().split())):
	if el < 0 or int(el ** 0.5) ** 2 != el:
		mx = max(mx, el)
print(mx)


import math
n = int(input())
x = list(map(int, input().split()))
x.sort()
ans = 0
for i in range(n):
	if x[i] < 0:
		ans = x[i]
	elif math.sqrt(x[i]) != round(math.sqrt(x[i])):
		ans = x[i]
print(ans)


import math
q = []
qq = []
p = []
x = []
xx = []
n = int(input())
a = input()
s = a.split()
for i in range(len(s)):
	s[i] = int(s[i])
	if s[i] >= 0:
		p.append(s[i])
	else:
		q.append(s[i])
for i in range(len(p)):
	r = math.sqrt(p[i])
	if r != int(r):
		x.append(p[i])
if len(q) > 0:
	n = max(q)
	if len(x) > 0:
		m = max(x)
		if m > n:
			print(m)
		if n > m:
			print(n)
	else:
		print(n)
else:
	m = max(x)
	print(m)


import itertools
n = int(input())
vals = list(map(int, input().split()))

def is_square(x):
	if x < 0:
		return False
	for i in itertools.count():
		if i ** 2 == x:
			return True
		if i ** 2 > x:
			return False
res = -10 ** 6 - 1
for x in vals:
	if x > res:
		if not is_square(x):
			res = x
print(res)


from math import sqrt
n = int(input())
a = list(map(int, input().split()))
M = float('-inf')
for i in range(n):
	if a[i] >= 0:
		yy = int(sqrt(a[i]))
		if yy * yy != a[i]:
			M = max(M, a[i])
	else:
		M = max(M, a[i])
print(M)


n = int(input())
inp = list(map(int, input().split()))
inp.sort(reverse=True)
for item in inp:
	if item < 0:
		print(item)
		break
	else:
		k = int(pow(item, 0.5))
		if k * k != item:
			print(item)
			break


def check(p, a):
	return p ** 2 >= a

def binSearch(a):
	if a < 0:
		return -1
	(left, right) = (-1, a + 1)
	while right - left > 1:
		mid = (left + right) // 2
		if check(mid, a):
			right = mid
		else:
			left = mid
	return right

def is_square(x):
	b = binSearch(x)
	return b != -1 and b ** 2 == x
n = int(input())
a = list(map(int, input().split()))
print(max((i for i in a if not is_square(i))))


import math
a = int(input())
b = list(map(int, input().split()))
k = 0
for i in range(len(b)):
	g = b[0]
	w = 0
	for h in range(1, len(b)):
		if b[h] > g:
			g = b[h]
			w = h
	if g < 0:
		print(g)
		break
		k += 1
	if g >= 0:
		ty = math.sqrt(g) % 1
		if math.sqrt(g) % 1 != 0:
			print(g)
			k += 1
		else:
			b.pop(w)
	if k == 1:
		break


from math import sqrt
n = int(input())
m = -10 ** 7
a = list(map(int, input().split()))
for i in range(n):
	if a[i] < 0:
		m = max(m, a[i])
	elif int(sqrt(a[i])) ** 2 != a[i]:
		m = max(m, a[i])
print(m)


import heapq as h
n = int(input())
L = list(map(lambda s: -int(s), input().split()))
h.heapify(L)
while L:
	c = h.heappop(L)
	if c > 0:
		break
	if (-c) ** 0.5 % 1 != 0:
		break
print(-c)


import math
_ = input()
m = None
aa = list(map(int, input().split()))
print(max([a for a in aa if a < 0 or int(math.sqrt(a)) * int(math.sqrt(a)) != a]))


n = int(input())
l = [int(x) for x in input().split()]
mx = -1000002
for i in l:
	if i > 0:
		c = i ** (1 / 2)
		d = int(c)
		if d / c != 1:
			mx = max(mx, i)
	elif i < 0:
		mx = max(mx, i)
print(mx)


n = int(input())
a = map(int, input().split())
print(max([i for i in a if i < 0 or int(i ** 0.5) ** 2 != i]))


i = input
i()
print(round(max(filter(lambda x: x < 0 or x ** 0.5 % 1, map(int, i().split())))))


import math
n = int(input())
a = list(map(int, input().split()))[:n]
MyMax = -1000000000
for i in a:
	if i >= 0:
		s = math.sqrt(i)
		if math.floor(s) != s and MyMax < i:
			MyMax = i
	elif MyMax < i:
		MyMax = i
print(MyMax)


n = int(input())
l = [int(i) for i in input().split()]
m = min(l)
for i in range(n):
	if l[i] < 0:
		m = max(l[i], m)
	elif l[i] ** 0.5 != int(l[i] ** 0.5):
		m = max(l[i], m)
print(m)


import math
n = int(input(''))
a = list(map(int, input().split()))
p = -9999999999
s = 0
q = 0
t = 0
for i in range(0, n):
	s = 0
	if a[i] < 0:
		if a[i] > p:
			p = a[i]
		continue
	b = math.sqrt(a[i])
	y = b - math.floor(b)
	if y != 0:
		if s == 1:
			a[i] *= -1
			s = 0
		if a[i] > p:
			p = a[i]
print(p)


from math import sqrt, pow
n = int(input())
l = list(map(int, input().split()))
v = []
ans = 0
flag = 0
for i in range(n):
	if l[i] != abs(l[i]) or sqrt(l[i]) != int(sqrt(l[i])):
		flag = 1
		v.append(l[i])
	elif sqrt(l[i]) != int(sqrt(l[i])):
		ans = max(ans, l[i])
if flag != 0:
	print(max(v))
else:
	print(ans)


n = int(input())
nums = [int(x) for x in input().split()]
squares = set()
for x in range(0, 1001):
	squares.add(x * x)
filtered_nums = [x for x in nums if x not in squares]
print(max(filtered_nums))


x = int(input())
l2 = []
l = list(map(int, input().split()))
for i in range(x):
	if l[i] < 0 or int(pow(l[i], 1 / 2)) * int(pow(l[i], 1 / 2)) != l[i]:
		l2.append(l[i])
l2.sort()
print(l2[-1])


input()
X = list(map(int, input().split()))
Positive = list(filter(lambda x: x > 0 and int(x ** 0.5) != x ** 0.5, X))
Negative = list(filter(lambda x: x < 0, X))
print(max(Positive) if len(Positive) != 0 else max(Negative))


from math import sqrt
n = int(input())
s = [int(i) for i in input().split()]
q = []
for i in s:
	if i > 0:
		if int(sqrt(i)) ** 2 != i:
			q.append(i)
	if i < 0:
		if -int(sqrt(-i)) ** 2 != -i:
			q.append(i)
print(max(q))


n = int(input())
L = list(map(int, input().split()))
L.sort()
FLAG = 0
for i in range(n - 1, -1, -1):
	if L[i] < 0:
		print(L[i])
		FLAG = 1
		break
	elif L[i] != int(pow(L[i], 0.5)) * int(pow(L[i], 0.5)):
		print(L[i])
		FLAG = 1
		break
if FLAG == 0:
	print(-1)


import math as m
n = input()
a = [int(x) for x in input().split()]
t1 = []
t2 = []
flag = 0
for i in a:
	if i < 0:
		t1.append(i)
	elif float(i) ** 0.5 - int(float(i) ** 0.5) != 0.0:
		t2.append(i)
t1 = t1 + t2
print(int(max(t1)))


import math

def is_perfect(n):
	if n < 0:
		return False
	nsqrt = math.sqrt(n)
	return nsqrt == math.trunc(nsqrt)
noe = int(input())
arr = [int(x) for x in input().split()]
nots = []
for i in arr:
	if is_perfect(i):
		continue
	else:
		nots.append(i)
print(max(nots))


import math
a = int(input())
k = list(map(int, input().split()))
l = []
for item in k:
	if item > 0:
		if math.sqrt(item) % 1 != 0:
			l.append(item)
	elif item < 0:
		l.append(item)
l.sort()
print(l[-1])


n = int(input())
a = list(map(int, input().split()))
from math import sqrt
a.sort(reverse=True)
for i in a:
	if i >= 0:
		if sqrt(i) != int(sqrt(i)):
			print(i)
			break
else:
	print(max(a, key=lambda a: a < 0))


import math

def is_perfect_square(n):
	return pow(int(math.sqrt(abs(n))), 2) == n
ans = -pow(10, 6)
n = int(input())
a = list(map(int, input().split()))
for x in a:
	if not is_perfect_square(x):
		ans = max(ans, x)
print(ans)


import math
n = int(input())
a = list(map(int, input().split()))
m = -99999999999
for i in a:
	if i >= 0:
		x = math.sqrt(i)
		x = str(x)
		x = x[x.index('.') + 1:]
		if int(x) != 0 and i > m:
			m = i
	elif i > m:
		m = i
print(m)


n = int(input())
l = list(map(int, input().split()))
l.sort()
import math
s = 0
for a in l:
	if a < 0:
		if s == 0:
			s = a
		elif a > s:
			s = a
	elif math.sqrt(a) > int(math.sqrt(a)) and a > s:
		s = a
print(s)


cantidad = int(input())
numeros = list(map(int, input().split()))
candidatos = []
for num in numeros:
	for i in range(0, 1001):
		if i * i == num:
			break
	else:
		candidatos.append(num)
menor = sorted(candidatos)[-1]
print(menor)


input()
for a in sorted(map(int, input().split()), reverse=True):
	if a < 0 or int(a ** 0.5) ** 2 < a:
		print(a)
		break


from math import sqrt
n = int(input().strip())
ar = [int(p) for p in input().split()]
li = []
for num in ar:
	if num < 0:
		li.append(num)
		continue
	n = sqrt(num)
	if n != int(n):
		li.append(num)
if li:
	print(max(li))
else:
	print(max(ar))


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
a.reverse()
k = 0
for i in a:
	if i >= 0:
		if int(i ** 0.5) == i ** 0.5:
			continue
		else:
			k += 1
			print(i)
			break
	else:
		print(i)
		k += 1
		break
if k == 0:
	print(-1)


import math

def perfect_square(num):
	if num < 0:
		return False
	num_sqrt = int(math.sqrt(num))
	return True if num_sqrt * num_sqrt == num else False
n = int(input())
ar = list(map(int, input().split()))
ans = int(-10000000.0)
for i in range(n):
	if not perfect_square(ar[i]):
		ans = max(ans, ar[i])
print(ans)


from math import sqrt
n = int(input())
x = [int(i) for i in input().split()]
x = sorted(x, reverse=True)
maxn = 0
for i in x:
	if i < 0:
		maxn = i
		break
	else:
		sq = sqrt(i)
		if sq != round(sq):
			maxn = i
			break
print(maxn)


import math

def perfect_square(x):
	if x < 0:
		return False
	else:
		y = x ** (1 / 2)
		if y - math.floor(y) == 0.0:
			return True
not_perfect_square_list = []
n = int(input())
if 1 <= n <= 1000:
	lis = list(map(int, input().split()))
	if len(lis) == n:
		for i in lis:
			if perfect_square(i):
				continue
			else:
				not_perfect_square_list.append(i)
	else:
		exit()
	print(max(not_perfect_square_list))
else:
	exit()


n = int(input())
nums = list(map(int, input().split()))
nums.sort()
for idx in range(len(nums) - 1, -1, -1):
	if nums[idx] < 0:
		print(nums[idx])
		break
	intSqrt = int(pow(nums[idx], 0.5))
	if intSqrt * intSqrt != nums[idx]:
		print(nums[idx])
		break


import math
n = int(input())
s = input().split()
s = list(map(int, s))
s.sort(reverse=True)
pos = 0
neg = []
for i in s:
	if i < 0:
		neg.append(i)
	else:
		root = math.sqrt(i)
		if root - math.floor(root) != 0:
			pos = i
			break
if len(neg) == 0:
	print(pos)
elif pos == 0:
	print(neg[0])
else:
	print(pos)


def right_square(n):
	if n > 0:
		return n ** 0.5 % int(n ** 0.5) == 0
	elif n == 0:
		return True
	return False
s = int(input())
lst = [int(j) for j in input().split()]
print(max([x for x in lst if not right_square(x)]))


L = [0] * 1001
for k in range(1, 1001):
	L[k] = k ** 2
n = int(input())
L1 = sorted(list(map(int, input().split())))
for k in range(1, n + 1):
	if not L1[-k] in L:
		print(L1[-k])
		break


import math
n = int(input())
a = list(map(int, input().split()))
ans = -1000000000.0
for i in range(0, n):
	if a[i] < 0:
		ans = max(ans, a[i])
	else:
		x = math.floor(math.sqrt(a[i]))
		if x * x == a[i]:
			continue
		ans = max(ans, a[i])
print(ans)


n = int(input())
a = {i * i for i in range(1001)}
b = [int(z) for z in input().split()]
b.sort(reverse=True)
for i in range(n):
	if b[i] not in a:
		print(b[i])
		exit(0)


import math
n = int(input())
num = list(map(int, input().split()))
greater = [x for x in num if x >= 0 and math.sqrt(x) != int(math.sqrt(x))]
if len(greater) > 0:
	print(max(greater))
else:
	neg = [x for x in num if x < 0]
	print(max(neg))


n = int(input())
a = list(map(int, input().split()))
a.sort()
import math
for i in a:
	if i < 0:
		r = i
	elif int(math.sqrt(i)) ** 2 != i:
		r = i
print(r)


import math
n = int(input())
a = [int(i) for i in input().split()]
ans = -10000000
for x in a:
	if x < 0:
		if x > ans:
			ans = x
		continue
	if int(math.sqrt(x)) * int(math.sqrt(x)) != x and x > ans:
		ans = x
print(ans)


import math
n = int(input())
a = list(map(int, input().split()))
a.sort()
for i in range(n):
	if a[n - 1 - i] < 0:
		print(a[n - 1 - i])
		exit()
	if math.sqrt(a[n - i - 1]) % 1 != 0:
		print(a[n - 1 - i])
		exit()


from math import sqrt
n = int(input())
s = set(map(int, input().split()))
while True:
	if len(s) != 1:
		if max(s) > 0 or max(s) == 0:
			if sqrt(max(s)).is_integer():
				s.remove(max(s))
			else:
				print(max(s))
				break
		else:
			print(max(s))
			break
	else:
		print(list(s)[0])
		break


import math
n = int(input())
arr = list(map(int, filter(None, input().split(' '))))
arr = sorted(arr, reverse=True)
num = -1
for a in arr:
	if a >= 0:
		sq = math.sqrt(a)
		if sq - math.floor(sq) == 0:
			continue
		else:
			num = a
			break
	else:
		num = a
		break
print(num)


input()
a = sorted(list(map(int, input().split())), reverse=True)
for ai in a:
	if ai < 0 or ai != int(ai ** 0.5) ** 2:
		print(ai)
		exit(0)


n = int(input())
l = list(map(int, input().split()))
l = sorted(l, reverse=True)
for i in range(n):
	t = int(pow(abs(l[i]), 0.5))
	if t * t != l[i]:
		print(l[i])
		break


input()
N = list(map(int, input().split()))
N.sort()
from math import *
for i in range(len(N) - 1, -1, -1):
	if N[i] < 0:
		print(N[i])
		break
	if N[i] != int(sqrt(N[i])) ** 2:
		print(N[i])
		break


n = int(input())
a = [int(i) for i in input().split()]
p = []
i = 0
while True:
	p.append(i * i)
	i += 1
	if p[-1] > 1000000:
		break
m = -99999999
for i in a:
	if i not in p:
		m = max(i, m)
print(m)


import math
n = int(input())
s = input()
s = s.split()
list = []
for a in s:
	a = int(a)
	list.append(a)
res = []
for a in list:
	if a >= 0:
		b = int(math.sqrt(a))
		if b * b != a:
			res.append(a)
	else:
		res.append(a)
print(max(res))


n = int(input())
s = list(map(int, input().split()))
s.sort()
s.reverse()
for i in range(n):
	if s[i] >= 0 and s[i] ** 0.5 == int(s[i] ** 0.5):
		i += 1
	else:
		break
print(s[i])


n = int(input())
s = set(map(int, input().split()))
t = set((i * i for i in range(1001)))
print(max(s - t))


n = int(input())
a = list(map(int, input().split()))
res = -1000000
for i in range(n):
	sq = False
	for j in range(1001):
		if j * j == a[i]:
			sq = True
			break
	if not sq:
		res = max(res, a[i])
print(res)


import math
N = int(input())
inp = input().split(' ')
L = [int(i) for i in inp]
ans_sq = -math.inf
for i in L:
	if i < 0 and i > ans_sq:
		ans_sq = i
	if i > ans_sq and i > 0:
		rt = math.sqrt(i)
		if rt != int(rt):
			ans_sq = i
print(ans_sq)


import math
n = int(input())
mat = sorted(list(map(int, input().split())))[::-1]
for i in mat:
	if i < 0:
		print(i)
		break
	elif math.sqrt(i) % 1 > 0:
		print(i)
		break


import math
n = int(input())
s = input().split()
a = []
for i in s:
	a.append(int(i))
a.sort()
a = a[::-1]
for i in a:
	if i < 0:
		print(i)
		break
	elif math.sqrt(i) != int(math.sqrt(i)):
		print(i)
		break


n = int(input())
l1 = list(map(int, input().split()))
l1.sort()
l1 = l1[::-1]
l = []
for i in range(1001):
	l.append(i ** 2)
for elem in l1:
	if elem not in l:
		print(elem)
		break


from math import sqrt
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
m = -1000000000000000
for i in range(len(a)):
	if a[i] >= 0:
		b = int(sqrt(a[i]))
		if b * b != a[i]:
			print(a[i])
			exit()
	else:
		m = max(m, a[i])
print(m)


from math import inf
from math import sqrt
n = int(input())
a = list(map(int, input().split()))
output = -inf
for i in range(n):
	if a[i] > output and (a[i] < 0 or sqrt(a[i]) != int(sqrt(a[i]))):
		output = a[i]
print(output)


n = int(input())
ans = -10 ** 18
for a in map(int, input().split()):
	if a < 0:
		ans = max(ans, a)
		continue
	t = int(a ** 0.5)
	if not ((t - 1) ** 2 == a or t ** 2 == a or (t + 1) ** 2 == a):
		ans = max(ans, a)
print(ans)


from math import sqrt
n = int(input())
l = list(map(int, input().split()))
print(max((x for x in l if x < 0 or round(sqrt(x)) * round(sqrt(x)) != x)))


R = lambda : map(int, input().split())
n = int(input())
a = list(R())
ans = -float('inf')
for i in range(n):
	if a[i] < 0:
		if a[i] > ans:
			ans = a[i]
	elif int(a[i] ** (1 / 2)) ** 2 != a[i] and a[i] > ans:
		ans = a[i]
print(ans)


n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
for i in a:
	if i >= 0:
		b = int(i ** 0.5)
		if b * b != i:
			print(i)
			break
	else:
		print(i)
		break


import math
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
	x = a[i]
	if x >= 0 and int(math.sqrt(x)) ** 2 == x:
		pass
	else:
		b.append(a[i])
print(max(b))


_ = int(input())
lst1 = set(map(int, input().split()))
lst2 = set([i * i for i in range(10001)])
ans = max(lst1 - lst2)
print(ans)


def check(i):
	if i >= 0 and pow(i, 0.5) == int(pow(i, 0.5)):
		return 1
	return 0
n = int(input())
l = [int(x) for x in input().split()]
ma = -10 ** 6
for i in l:
	if check(i) == 0:
		ma = max(ma, i)
print(ma)


n = int(input())
lst = []
for x in input().split():
	lst.append(int(x))
max_n = -10 ** 6 - 1
for x in lst:
	if x >= 0:
		k1 = -1
		k2 = 10 ** 6 + 1
		while k2 - k1 > 1:
			k = (k1 + k2) // 2
			if k ** 2 >= x:
				k2 = k
			else:
				k1 = k
		if k2 ** 2 != x:
			max_n = max(max_n, x)
	else:
		max_n = max(max_n, x)
print(max_n)


from math import sqrt
n = int(input())
a = input().split()
for i in range(n):
	a[i] = int(a[i])
a.sort(reverse=True)
for i in range(n):
	if a[i] < 0 or int(sqrt(a[i])) ** 2 != a[i]:
		break
print(a[i])


import math
n = int(input())
m = list(map(int, input().split()))
l = []
for i in m:
	if i >= 0:
		x = math.sqrt(i)
		if int(x) ** 2 != i:
			l.append(i)
	else:
		l.append(i)
print(max(l))


(n, l) = (int(input()), [int(x) for x in input().split()])
not_perfect = [x for x in l if x >= 0 and int(x ** 0.5) != x ** 0.5 or x < 0]
print(max(not_perfect))


import math
n = int(input())
a = [int(i) for i in input().split()]
ans = -1000000
for i in a:
	if i >= 0 and math.sqrt(i) % 1 != 0:
		ans = max(i, ans)
	elif i < 0:
		ans = max(i, ans)
print(ans)


from math import sqrt
n = input()
t = input().split(' ')
l = []

def isSquare(a):
	if a < 0:
		return False
	if a == 0:
		return True
	for k in range(1, a + 1):
		if k * k == a:
			return True
		if k * k > a:
			return False
	return False
for k in t:
	if k:
		l.append(int(k))
l = reversed(sorted(l))
for k in l:
	if not isSquare(k):
		print(k)
		break


from math import sqrt
n = int(input())
max = -10 ** 6 - 1
for a in map(int, input().split()):
	if a < 0 or sqrt(a) % 1 != 0:
		if a > max:
			max = a
print(max)


from math import sqrt
t = int(input())
s = list(map(int, input().split(' ')))
max = min(s)
for i in s:
	if i < 0 and i > max:
		max = i
	if i > 0 and sqrt(abs(i)) % 1 != 0 and (i > max):
		max = i
print(max)


from math import sqrt, floor
int(input())
for n in sorted(map(int, input().split()))[::-1]:
	if abs(n) != n:
		print(n)
		break
	elif floor(sqrt(n)) - sqrt(n) != 0:
		print(n)
		break


n = input()
a = sorted([int(i) for i in input().split()], reverse=True)
square_list = [i ** 2 for i in range(1001)]
for i in a:
	if i not in square_list:
		print(i)
		break


n = int(input())
li = [int(x) for x in input().split()]
li.sort()
j = 1
while True:
	if li[-j] < 0:
		break
	vd = li[-j] ** 0.5
	vi = int(vd * 100000)
	vd = int(vd) * 100000
	if vi != vd:
		break
	j += 1
print(li[-j])


n = int(input())
l = list(map(int, input().split()))
ls = []
for i in range(n):
	x = 0
	if l[i] >= 0:
		x = int(l[i] ** 0.5)
	if l[i] != x * x or l[i] < 0:
		ls.append(l[i])
ls.sort()
print(ls[-1])


import math
a = {i + 1 for i in range(1000)}
k = -10 ** 6
n = input()
m = [int(i) for i in input().split()]
for i in m:
	if i > 0:
		c = math.sqrt(i)
		if c not in a and i > k:
			k = i
	elif i < 0:
		k = max(i, k)
print(k)


import math
total = int(input())
if total == 1:
	winner = int(input())
	answer = winner
else:
	array = input().split()
	numbers_array = []
	for i in array:
		numbers_array.append(int(i))
	numbers_array = sorted(numbers_array)
	found = False
	answer = 0
	for num in numbers_array[::-1]:
		if not found and num ** 0.5 != int(abs(num) ** 0.5):
			answer = num
			found = True
print(answer)


from math import sqrt
n = int(input())
l = list(map(int, input().split()))
l2 = []
for i in range(n):
	if l[i] >= 0:
		x = int(sqrt(l[i]))
		if x * x != l[i]:
			l2.append(l[i])
	else:
		l2.append(l[i])
print(max(l2))


from math import sqrt, floor

def isPerfectSquare(n):
	s = sqrt(abs(n))
	return s - floor(s) == 0
n = int(input())
nums = list(map(int, input().split()))
nums = sorted(nums, reverse=True)
for i in nums:
	if i < 0:
		result = i
		break
	if not isPerfectSquare(i):
		result = i
		break
print(result)


from functools import reduce
import sys
import math

def check(x):
	if x < 0:
		return True
	f = math.sqrt(x)
	f = math.floor(f)
	return f * f != x
input()
a = map(int, input().split())
ans = reduce(max, filter(check, a))
print(ans)


from math import *
n = int(input())
l = input().split(' ')
s = -1000000
for i in range(n):
	a = int(l[i])
	if a >= 0:
		if sqrt(a) != int(sqrt(a)):
			if a > s:
				s = a
	elif a > s:
		s = a
print(s)


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
for i in a:
	if i < 0 or i ** 0.5 % 1 != 0:
		print(i)
		quit()


n = int(input())
T = input().split()
ans = -213721372137213721372137213721372137213721372137213721372137213721372137213721372137
for i in range(0, n):
	cur = int(T[i])
	ok = 1
	for k in range(0, 1001):
		if k * k == cur:
			ok = 0
	if ok == 1 and cur > ans:
		ans = cur
print(ans)


input()
a = map(int, input().split())
m = -1061109567
for x in a:
	if x < 0 or round(x ** 0.5) ** 2 != x:
		m = max(m, x)
print(m)


import math

def check(x):
	r1 = math.sqrt(x)
	if r1 - math.ceil(r1) == 0:
		return True
	return False
n = int(input())
arr = list(map(int, input().split()))
arr = list(reversed(sorted(arr)))
res = []
l = []
for i in arr:
	if i < 0:
		l.append(i)
	if i > 0 and check(i) == False:
		res.append(i)
		break
if len(res) == 0:
	print(max(l))
else:
	print(*res)


import math

def check(a):
	try:
		b = int(math.sqrt(a))
		if b * b == a:
			return False
		else:
			return True
	except:
		return True
n = int(input())
c = []
a = set(map(int, input().split()))
m = max(a)
for i in a:
	if check(i):
		c.append(i)
print(max(c))


import math
n = int(input())
l = list(map(int, input().split()))
l.sort()
for i in range(n - 1, -1, -1):
	if l[i] < 0:
		print(l[i])
		break
	elif int(math.sqrt(l[i])) != math.sqrt(l[i]):
		print(l[i])
		break


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
for i in a[::-1]:
	low = 0
	high = i
	flag = 1
	while low <= high:
		mid = (low + high) // 2
		if mid ** 2 == i:
			flag = 0
			break
		elif mid * mid < i:
			low = mid + 1
		else:
			high = mid - 1
	if flag == 1:
		print(i)
		exit(0)


n = int(input())
a = list(map(int, input().split()))
b = []
for i in a:
	if i >= 0:
		x = i ** (1 / 2) - int(i ** (1 / 2))
		if x != 0:
			b.append(i)
	else:
		b.append(i)
print(max(b))


import math
input()
res = float('-inf')
for x in map(int, input().split()):
	if x < 0:
		res = max(res, x)
	else:
		tmp = int(math.sqrt(x))
		if tmp * tmp != x:
			res = max(res, x)
print(res)


n = int(input())
a = list(map(int, input().strip().split()))
m = -10 ** 10
for i in a:
	if i >= 0:
		b = i ** 0.5
		c = round(b)
		if b != c:
			m = max(m, i)
	else:
		m = max(i, m)
print(m)


SQR = set((x * x for x in range(1001)))
N = int(input())
Asqr = [int(x) for x in input().split() if int(x) not in SQR]
print(max(Asqr))


n = int(input())
m = [int(i) for i in input().split()]
a = []
while len(m) != 0:
	a.append(max(m))
	m.remove(max(m))
for i in a:
	if i > 0:
		if int(i ** 0.5) != i ** 0.5:
			print(i)
			break
	if i < 0:
		print(i)
		break


n = int(input())
a = map(int, input().split())
ans = -100000000000000000000000000000

def is_sqr(x):
	if x < 0:
		return False
	b = int(x ** 0.5)
	b += 123
	for i in range(b):
		if i * i == x:
			return True
	return False
for i in a:
	if not is_sqr(i):
		ans = max(ans, i)
print(ans)


n = int(input())
ai = list(map(int, input().split()))
ai.sort()
for i in range(n - 1, -1, -1):
	ans = ai[i]
	if ans < 0 or int(ans ** 0.5) ** 2 != ans:
		break
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
best = -10 ** 6
for x in a:
	is_perfect_square = False
	for d in range(1000 + 1):
		if d * d == x:
			is_perfect_square = True
	if not is_perfect_square:
		best = max(best, x)
print(best)


t = int(input())
x = list(map(int, input().split()))
x.sort()
for i in range(len(x) - 1, -1, -1):
	if int(abs(x[i] ** (1 / 2))) ** 2 != x[i]:
		print(x[i])
		break


n = int(input())
l1 = [int(x) for x in input().split()]
l1.sort()
l1.reverse()
for x in l1:
	if x < 0 or x != int(x ** (1 / 2)) * int(x ** (1 / 2)):
		print(x)
		break


import random
import sys
import os
import math
n = int(input())
arr = []
num = input()
arr = list(map(int, num.split(' ')))
maxnum = float('-inf')
for x in range(0, len(arr)):
	if arr[x] >= 0 and (not math.sqrt(arr[x]).is_integer()) and (maxnum < arr[x]):
		maxnum = arr[x]
	elif arr[x] < 0 and maxnum < arr[x]:
		maxnum = arr[x]
print(int(maxnum))


n = int(input())
l = list(map(int, input().split(' ')))
v = []
c = []
for i in range(n):
	if l[i] < 0:
		v.append(l[i])
	elif l[i] ** 0.5 > int(l[i] ** 0.5):
		c.append(l[i])
if len(c) > 0:
	print(max(c))
else:
	print(max(v))


import sys
n = int(input())
L = list(map(int, input().split()))
e = {x ** 2 for x in range(0, int((10 ** 6 + 2) ** 0.5) + 10)}
L.sort(reverse=True)
for x in L:
	if x not in e:
		print(x)
		sys.exit(0)


from math import sqrt
n = int(input())
its = [int(k) for k in input().split()]
result = -100000000
for e in its:
	if e < 0:
		result = max(result, e)
	else:
		sq = sqrt(e)
		good = True
		vars = [int(sq - 1), int(sq), int(sq + 1)]
		for p in vars:
			if p * p == e:
				good = False
		if good:
			result = max(result, e)
print(result)


def square(n):
	if n < 0:
		return False
	lo = 0
	hi = n
	while lo + 1 < hi:
		mid = (lo + hi) // 2
		if mid * mid > n:
			hi = mid
		if mid * mid < n:
			lo = mid
		if mid * mid == n:
			return True
	if lo * lo == n or hi * hi == n:
		return True
	return False
n = int(input())
line = input().split()
best = -10 ** 7
for i in range(n):
	a = int(line[i])
	if not square(a):
		best = max(best, a)
print(best)


import sys
import math
a = int(sys.stdin.readline().split()[0])
b = [int(x) for x in sys.stdin.readline().split()]
b.sort(reverse=True)
for i in b:
	if i < 0:
		print(i)
		break
	if int(math.sqrt(i)) ** 2 != i:
		print(i)
		break


from math import sqrt
n = int(input())
s = [int(i) for i in input().split()]
c = -10 ** 6
for i in range(n):
	if s[i] < 0:
		c = max(c, s[i])
	elif sqrt(s[i]).is_integer() == False:
		c = max(c, s[i])
print(c)


import math
num = int(input())
lst = [int(x) for x in input().split()]
lst = sorted(lst, reverse=True)
for i in lst:
	if i > 0:
		if round(math.sqrt(i)) != math.sqrt(i):
			print(i)
			break
	elif i < 0:
		print(i)
		break


n = int(input())
ns = list(map(int, input().split()))
ns.sort()
for i in range(n):
	a = ns[n - 1 - i]
	if a < 0:
		print(a)
		break
	if int(a ** (1 / 2)) != a ** (1 / 2):
		print(a)
		break


n = int(input())
a = [int(i) for i in input().split()]
mn = -100000000000000
for i in a:
	if i < 0:
		mn = max(mn, i)
		continue
	v = int(i ** 0.5)
	if v * v != i and (v + 1) * (v + 1) != i and ((v - 1) * (v - 1) != i):
		mn = max(mn, i)
print(mn)


import math
n = int(input())
a = list(map(int, input().split()))
l = []
for i in range(n):
	if a[i] >= 0:
		root = math.sqrt(a[i])
		if int(root) ** 2 != a[i]:
			l.append(a[i])
	else:
		l.append(a[i])
print(max(l))


n = int(input())
a = list(map(int, input().split()))
a.sort()
max = a[0]
for i in range(n):
	if a[i] >= 0:
		if float(a[i] ** (1 / 2)) % 1 != 0.0:
			if a[i] > max:
				max = a[i]
	elif a[i] > max:
		max = a[i]
print(max)


n = int(input())
a = list(map(int, input().split()))
s = {i * i for i in range(1001)}
print(max([i for i in a if i not in s]))


n = int(input().strip())
arr = list(map(int, input().strip().split()))
arr.sort(reverse=True)
for i in arr:
	if i < 0:
		print(i)
		break
	sq = i ** 0.5
	if sq != int(sq):
		print(i)
		break


import cmath
n = int(input())
mas = list(map(int, input().split()))
mas.sort()
mas.reverse()
for el in mas:
	if el >= 0:
		if '.' in str(cmath.sqrt(el)):
			print(el)
			exit(0)
	else:
		print(el)
		exit(0)


n = int(input())
tab = list(map(int, input().split()))
tab.sort()
for i in range(n):
	if tab[-i - 1] < 0 or tab[-i - 1] ** 0.5 % 1 != 0:
		print(tab[-i - 1])
		break


n = int(input().strip())
data = list(map(int, input().split()))
data = [x for x in data if x < 0 or int(x ** 0.5) ** 2 != x]
print(max(data))


n = int(input())
l = list(map(int, input().split()))

def kd(n):
	if n < 0:
		n *= -1
	ans = {1, n}
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			ans |= {i, n // i}
	return ans
ma = -10 ** 12
for j in l:
	if j == 0:
		continue
	elif j < 0:
		if j > ma:
			ma = j
	elif len(kd(j)) % 2 == 0:
		if j > ma:
			ma = j
print(ma)


import math as m
n = int(input())
arr = list(map(int, input().split()))
var = -1000000
for i in arr:
	if i < 0:
		var = max(i, var)
	elif m.sqrt(i) * 10 % 10 != 0:
		var = max(var, i)
print(var)


n = int(input())
m = -10000000000
for i in list(map(int, input().split())):
	if i < 0:
		m = max(m, i)
		continue
	t = i ** 0.5
	if t - int(t) != 0.0:
		m = max(i, m)
print(m)


import math
no = input()
s = list(map(int, input().split()))
s.sort(reverse=True)
for i in s:
	if i < 0:
		print(i)
		break
	l = math.sqrt(i)
	if l - int(l) > 0:
		print(i)
		break


n = int(input())
best = -1000000000
for i in map(int, input().split()):
	if i < 0:
		best = max(best, i)
		continue
	if i ** 0.5 != int(i ** 0.5):
		best = max(best, i)
print(best)


import math
n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
for i in l:
	if i >= 0 and math.sqrt(i) % 1 != 0:
		print(i)
		break
	elif i < 0:
		print(i)
		break


n = int(input())
print(max(map(lambda x: -10 ** 7 if x >= 0 and int(x ** 0.5) ** 2 == x else x, [int(x) for x in input().split()])))


n = int(input())
l = list(map(int, input().split()))
while True:
	m = max(l)
	s = m ** 0.5
	if m < 0:
		print(m)
		break
	if s != int(s):
		print(m)
		break
	else:
		l.remove(m)


import math
a = int(input())
n = input().split()
lst = []
for i in n:
	if int(i) >= 0:
		k = int(i)
		d = math.sqrt(k)
		r = int(d + 0.5) ** 2
		if r != k:
			lst.append(k)
	else:
		k = int(i)
		lst.append(k)
print(max(lst))


d = set([])
for i in range(1002):
	s = i * i
	d.add(s)
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
for i in a:
	if i not in d:
		print(i)
		break


from math import floor, ceil
a = int(input())
li2 = []
li1 = list((i for i in map(int, input().split())))
for ii in li1:
	if ii >= 0 and floor(ii ** 0.5) == ceil(ii ** 0.5):
		li2.append(ii)
li3 = list((i for i in li1 if i not in li2))
print(max(li3))


a = int(input())
import math
t = list(map(int, input().split()))
t.sort()
x = 0
for j in range(a - 1, -1, -1):
	if t[j] > 0:
		c = math.sqrt(t[j])
		if c != int(c):
			print(t[j])
			x += 1
			break
if x == 0:
	for h in t[::-1]:
		if h < 0:
			print(h)
			break


def main():
	from math import sqrt
	n = int(input())
	row = input()
	arr = row.split(' ')
	maximum = -float('Inf')
	for item in arr:
		if int(item) >= 0:
			if not sqrt(int(item)).is_integer():
				maximum = max(maximum, int(item))
		else:
			maximum = max(maximum, int(item))
	print(maximum)
main()


import math

def Check(x):
	if x < 0:
		return True
	if math.floor(math.sqrt(x)) * math.floor(math.sqrt(x)) == x:
		return False
	return True
n = int(input())
a = list(input().split())
mx = -999999999
for x in a:
	y = int(x)
	if Check(y) and y > mx:
		mx = y
print(mx)


import math
n = input()
n = int(n)
s = input()
a = s.split()
for i in range(0, n):
	a[i] = int(a[i])
a.sort()
for i in range(n - 1, -1, -1):
	if a[i] < 0:
		print(a[i])
		break
	if int(a[i] ** 0.5) * int(a[i] ** 0.5) != a[i]:
		print(a[i])
		break


from math import sqrt
n = int(input())
l = [int(x) for x in input().split(' ')]
max = -1000000
for a in l:
	if a > max:
		if a < 0:
			max = a
		else:
			temp = round(sqrt(a))
			if temp * temp != a:
				max = a
print(max)


from math import sqrt

def check(x):
	now = int(sqrt(x))
	return now * now != x
n = int(input())
a = list(map(int, input().split()))
a.sort()
for i in range(n - 1, -1, -1):
	if a[i] < 0 or check(a[i]):
		print(a[i])
		exit()


import math
n = input()
a = input().split()
b = [int(x) for x in a]
ans = -1000001
for x in b:
	if x < 0:
		if x > ans:
			ans = x
	elif math.sqrt(x) - int(math.sqrt(x)):
		if x > ans:
			ans = x
print(ans)


import math

def valid(x):
	if x < 0:
		return True
	l = 0
	r = 2000
	while l <= r:
		m = (r + l) // 2
		if m * m < x:
			l = m + 1
		elif m * m > x:
			r = m - 1
		else:
			return False
	return True
n = int(input())
a = list(map(int, input().split(' ')))
ans = -10 ** 6
for i in range(n):
	if valid(a[i]):
		ans = max(ans, a[i])
print(ans)


from math import sqrt

def perfect(arr):
	for i in sorted(arr, reverse=True):
		if i < 0:
			return i
		x = sqrt(i)
		if x != int(x):
			return i
n = int(input())
arr = list(map(int, input().split()))
print(perfect(arr))


import math

def solve(L: list):
	L.sort(reverse=True)
	for x in L:
		if x < 0 or not is_square(x):
			print(x)
			return

def is_square(x):
	return int(math.sqrt(x)) ** 2 == x
n = int(input())
L = map(int, input().split())
solve(list(L))


n = int(input())
l = list(map(int, input().strip().split()[:n]))
z = []
k1 = False
for x in l:
	k = abs(x) ** (1 / 2)
	if int(k) != k or x < 0:
		z.append(x)
		k1 = True
if k1 == True:
	print(max(z))
else:
	print(-1)


from pprint import pprint as pp

def GI():
	return int(input())

def GIS():
	return map(int, input().split())
from math import sqrt, floor

def main():
	GI()
	m = -10 ** 7
	for x in GIS():
		if x < 0:
			m = max(x, m)
		else:
			s = sqrt(x)
			if s != floor(s):
				m = max(x, m)
	print(m)
main()


from math import sqrt
n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
for i in range(len(a)):
	p = a[i]
	if p < 0:
		print(p)
		break
	elif int(sqrt(p)) ** 2 == p:
		continue
	else:
		print(p)
		break


n = int(input())
ip = list(map(int, input().split()))
high = -10000000
for i in ip:
	if i > high:
		if i < 0:
			high = i
		elif i ** 0.5 % 1 == 0:
			pass
		else:
			high = i
print(high)


n = int(input())
a = list(map(int, input().split()))
res = -int(1000000000.0)
for x in a:
	if x < 0:
		res = max(res, x)
	else:
		s = int(x ** 0.5 + 0.5)
		if s ** 2 != x:
			res = max(res, x)
print(res)


import math
n = int(input())
a = list(map(int, input().split()))
m = -1000001
for i in range(n):
	if a[i] < 0 or math.sqrt(a[i]) != int(math.sqrt(a[i])):
		m = max(m, a[i])
print(m)


import math
t = int(input())
a = list(map(int, input().split()))
a.sort()
for i in range(t - 1, -1, -1):
	if a[i] >= 0:
		d = int(math.sqrt(a[i]))
		if d * d != a[i]:
			print(a[i])
			break
	else:
		print(a[i])
		break


from collections import *
from heapq import *
import bisect
from math import *
n = int(input())
a = [i for i in map(int, input().split())]
a.sort(reverse=True)
for i in a:
	if i < 0 or sqrt(i) // 1 != sqrt(i):
		print(i)
		break


def is_perfect_square(n):
	return round(n ** 0.5) ** 2 == n
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
b = [i for i in a if i < 0]
b.sort()
f = 0
for i in a:
	if i > 0 and (not is_perfect_square(i)):
		print(i)
		f = 1
		break
if not f:
	print(b[-1])


def main():
	N = int(input())
	A = tuple(map(int, input().split()))
	a = sorted(A, reverse=1)
	for i in a:
		if i < 0:
			print(i)
			break
		else:
			for j in range(1000, -1, -1):
				if i == j * j:
					break
				elif i > j * j:
					print(i)
					return
main()


input()
ar = list(map(int, input().split()))
maxim = -10 ** 6
for i in ar:
	if (i < 0 or int(i ** 0.5) ** 2 != i) and i > maxim:
		maxim = i
print(maxim)


input()
print(max((int(x) for x in input().split() if int(x) < 0 or not (int(x) ** 0.5).is_integer())))


import math
getInputList = lambda : list(input().split())
getInputIntList = lambda : list(map(int, input().split()))
n = int(input())
arr = getInputIntList()
arr.sort(reverse=True)
a = set([])
for i in range(1002):
	a.add(i * i)
for i in arr:
	if i not in a:
		print(i)
		break


n = int(input())
a = list(map(int, input().split(' ')))
b = {i * i for i in range(1001)}
ans = -float('inf')
for i in a:
	if i not in b:
		ans = max(i, ans)
print(ans)


import math
n = int(input())
array = [int(j) for j in input().split()]
l = []
o = []
for i in array:
	if i < 0:
		o.append(i)
	elif not math.sqrt(i).is_integer():
		l.append(i)
if l:
	print(max(l))
elif not l and o:
	print(max(o))


n = input()
j = []
x = [int(x) for x in input().split()]
for i in x:
	if i < 0:
		j.append(i)
	elif int(i ** 0.5) != i ** 0.5:
		j.append(i)
print(max(j))


squares = {i ** 2 for i in range(1001)}
input()
print(max(filter(lambda v: v not in squares, map(int, input().split()))))


from math import sqrt
n = int(input())
nums = list(map(int, input().strip().split(' ')))
nums.sort(reverse=True)
for num in nums:
	if num < 0:
		print(num)
		break
	sq_rt = sqrt(num)
	if sq_rt - int(sq_rt) != 0:
		print(num)
		break


n = int(input())
a = [int(x) for x in input().strip().split()]
ans = float('-inf')
m = 0
squares = set()
while True:
	sq = m * m
	if sq > 10 ** 6:
		break
	squares.add(sq)
	m += 1
for ai in a:
	if ai not in squares:
		ans = max(ans, ai)
print(ans)


n = int(input())
nums = list(map(int, input().strip().split()))
largestnsq = -10 ** 7
for e in nums:
	if e < 0:
		largestnsq = max(e, largestnsq)
	else:
		k = round(e ** 0.5)
		if k * k == e:
			pass
		else:
			largestnsq = max(e, largestnsq)
print(largestnsq)


n = int(input())
a = [int(i) for i in input().split()]
ans = -10 ** 100
for i in a:
	if i >= 0:
		sq = int(i ** 0.5)
		if sq ** 2 != i:
			ans = max(ans, i)
	else:
		ans = max(ans, i)
print(ans)


def check_square(n):
	result = False
	if n >= 0:
		for i in range(n + 1):
			if i ** 2 == n:
				result = True
			elif i ** 2 > n:
				break
	return result
n = int(input())
l = []
l = list(map(int, input().split()))
l.sort(reverse=True)
for i in l:
	if not check_square(i):
		print(i)
		break


import math
import bisect as bis
import heapq
n = int(input())
a = [int(i) for i in input().split()]
a = sorted(a)
i = n - 1
while i >= 0:
	if a[i] < 0:
		break
	y = math.sqrt(a[i])
	if math.ceil(y) != y:
		break
	i -= 1
print(a[i])


from math import sqrt
n = int(input())
a = [int(i) for i in input().split()]
mx = float('-inf')
for x in a:
	if x < 0:
		mx = max(mx, x)
	elif not sqrt(x).is_integer():
		mx = max(mx, x)
print(mx)


squares = []
i = 0
while i * i <= 10 ** 6:
	squares.append(i * i)
	i += 1
maxInp = -1 * 10 ** 7
n = int(input())
for i in list(map(int, input().split(' '))):
	if i not in squares and i > maxInp:
		maxInp = i
print(maxInp)


input()
print(max(set(map(int, input().split())) - set([i ** 2 for i in range(1001)])))


n = int(input())
L = list(map(int, input().split(' ')))
L = sorted(L, reverse=True)
i = 0
while L[i] >= 0 and int(L[i] ** (1 / 2)) - L[i] ** (1 / 2) == 0:
	i = i + 1
print(L[i])


from math import sqrt
n = int(input())
arr = input().split()
for i in range(len(arr)):
	arr[i] = int(arr[i])
arr2 = []
for i in range(len(arr)):
	if arr[i] >= 0:
		if sqrt(arr[i]) % 1 != 0:
			arr2.append(arr[i])
	else:
		arr2.append(arr[i])
print(max(arr2))


import math
n = int(input())
a = list(map(int, input().split()))
m = -10 ** 6
for i in range(n):
	if a[i] < 0:
		m = max(m, a[i])
	elif a[i] >= 0 and math.sqrt(a[i]) != int(math.sqrt(a[i])):
		m = max(m, a[i])
print(m)


n = int(input())
arr = list(map(int, input().split()))
M = -10 ** 7
for num in arr:
	if num >= 0:
		r_num = num ** 0.5
		if int(r_num) == r_num:
			continue
	if num > M:
		M = num
print(M)


n = int(input())
l = [int(i) for i in input().split()]
mi = -10000000
ma = -10000000
f = False
from math import sqrt
for i in l:
	if i < 0 and i > mi:
		mi = i
	elif i >= 0 and sqrt(i) - int(sqrt(i)) != 0 and (i > ma):
		ma = i
		f = True
if f:
	print(ma)
else:
	print(mi)


import math
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
for x in a:
	if x < 0:
		print(x)
		exit(0)
	y = int(math.sqrt(x))
	if y * y != x:
		print(x)
		exit(0)


from math import sqrt

def issquare(x):
	if x < 0:
		return False
	y = int(sqrt(x))
	return y * y == x
n = int(input())
a = list(map(int, input().split()))
m = -int(1000000.0 + 100)
for i in range(n):
	if not issquare(a[i]) and m < a[i]:
		m = a[i]
print(m)


a = int(input())
n = [int(i) for i in input().split()]
d = -1 * 1000000 - 1
for i in range(a):
	if n[i] > -1 and n[i] ** 0.5 % 1 != 0 and (n[i] > d):
		d = n[i]
	elif n[i] < 0:
		if n[i] > d:
			d = n[i]
print(d)


import math
n = int(input())
arr = [int(x) for x in input().split()]
max_ns = float('-inf')
for num in arr:
	if num < 0 or math.sqrt(num) != math.sqrt(num) // 1:
		if num > max_ns:
			max_ns = num
print(max_ns)


input()
prnt = -10000000
for x in list(map(int, input().split())):
	if x >= 0:
		prnt = max(prnt, x) if int(abs(x) ** 0.5) ** 2 != abs(x) else prnt
	else:
		prnt = max(prnt, x)
print(prnt)


def main():
	import math
	x = eval(input())
	list1 = sorted(list(map(int, input().split(' '))), reverse=True)
	for i in list1:
		if int(math.sqrt(abs(i))) ** 2 != i:
			print(i)
			break
main()


n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
for i in l[::-1]:
	if i < 0:
		print(i)
		exit()
	elif i ** 0.5 % 1 != 0:
		print(i)
		exit()


import math
n = input()
firstline = input().strip()
narray = firstline.split()
max_num = -9999999
for number in narray:
	num = int(number)
	if num >= 0:
		val = math.sqrt(num)
		if int(val) * int(val) != num:
			if num > max_num:
				max_num = num
	elif num > max_num:
		max_num = num
print(max_num)


n = int(input())
a = [int(x) for x in input().split()]
w = []
for i in range(0, 1000000):
	w.append(i * i)
m = min(a)
for i in a:
	if i > m and i not in w:
		m = i
print(m)


from math import sqrt
n = int(input())
a = list(map(int, input().split()))
a.sort()
for i in range(n):
	if a[n - 1 - i] >= 0:
		b = sqrt(a[n - 1 - i])
		if int(b) ** 2 != a[n - 1 - i]:
			print(a[n - 1 - i])
			break
	else:
		print(a[n - 1 - i])
		break


import math

def psq(m):
	x = int(math.sqrt(m))
	if m == x * x:
		return 1
	else:
		return 0
n = int(input())
a = list(map(int, input().split()))
m = max(a)
if m < 0:
	print(m)
else:
	while psq(m) != 0:
		a.remove(m)
		m = max(a)
		if m < 0:
			break
	print(m)


import math
a = int(input())
b = [int(i) for i in input().split()]
b = sorted(b, reverse=True)
for i in range(0, len(b)):
	if b[i] < 0:
		print(b[i])
		break
	else:
		e = math.sqrt(b[i])
		if math.ceil(e) != math.floor(e):
			print(b[i])
			break
		else:
			pass


n = int(input())
sequence = list(map(int, input().split()))
sequence.sort(reverse=True)
for i in sequence:
	if i < 0:
		unperfect_square = i
		break
	elif round(i ** 0.5) ** 2 != i:
		unperfect_square = i
		break
print(unperfect_square)


inp = input()
inp0 = input()
inp0 = inp0.split(' ')
data = []
i = 0
while i < len(inp0):
	if int(inp0[i]) > 0:
		if int(inp0[i]) ** (1 / 2) != int(int(inp0[i]) ** (1 / 2)):
			data.append(int(inp0[i]))
	elif int(inp0[i]) != 0:
		data.append(int(inp0[i]))
	i = i + 1
if len(data) > 0:
	print(max(data))


import math
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
for i in range(N):
	t = A[i]
	if t >= 0:
		r = int(math.sqrt(t))
		if r * r != t:
			print(t)
			break
	else:
		print(t)
		break


from math import sqrt
import math

def checkpsqure(x):
	r1 = sqrt(x)
	r2 = math.floor(r1)
	r3 = r1 - r2
	if r3 == 0:
		return True
	return False
n = int(input())
arr = list(map(int, input().split()))
arr = list(reversed(sorted(arr)))
res = -100000000
for i in arr:
	if i > 0:
		if checkpsqure(i) == False:
			res = max(i, res)
	if i < 0:
		res = max(i, res)
print(res)


from math import sqrt
n = int(input())
A = list(map(int, input().split()))
print(max((a for a in A if a < 0 or int(sqrt(a)) ** 2 != a)))


n = int(input())
a = list(map(int, input().split()))

def isSquare(a):
	if a < 0:
		return False
	(l, r) = (0, 1000001)
	while r - l > 1:
		mid = r + l >> 1
		if mid * mid > a:
			r = mid
		else:
			l = mid
	return l * l == a
print(max((x for x in a if not isSquare(x))))


from math import sqrt
n = int(input())
nums = [int(_) for _ in input().split(' ')]
sorted_nums = sorted(nums, reverse=True)
max_a = max(sorted_nums[0], abs(sorted_nums[-1]))
quadro = [x ** 2 for x in range(int(sqrt(max_a) + 1))]
for a in sorted_nums:
	if a not in quadro:
		print(a)
		exit(0)


def main():
	from sys import stdin, stdout
	from math import sqrt, ceil
	stdin.readline()
	arr = list(map(int, stdin.readline().split()))
	arr.sort(reverse=True)
	for i in arr:
		if i >= 0:
			y = ceil(sqrt(i))
			if y * y != i:
				stdout.write(str(i))
				return
		else:
			stdout.write(str(i))
			return
main()


s = []
for i in range(2000):
	s += [i * i]
n = int(input())
a = list(map(int, input().split()))
a.sort()
for i in a:
	if i not in s:
		ans = i
print(ans)


n = int(input())
m = list(map(int, input().split()))
vals = []
for i in m:
	a = i ** 0.5
	a = str(a)
	b = a.split('.')
	if '0' != b[1]:
		vals.append(i)
print(max(vals))


n = int(input())
a = list(map(int, input().split(' ')))
ans = -10 ** 6
for i in range(n):
	valid = True
	if a[i] >= 0:
		for j in range(2000):
			if j * j == a[i]:
				valid = False
	if valid:
		ans = max(ans, a[i])
print(ans)


import math
n = int(input())
a = list(map(int, input().split(' ')))
ans = -10 ** 6
for i in range(n):
	valid = True
	if a[i] >= 0:
		cur = int(math.sqrt(a[i]))
		if cur ** 2 == a[i]:
			valid = False
	if valid:
		ans = max(ans, a[i])
print(ans)


import math

def __isPF(n):
	root = int(math.sqrt(n))
	if root ** 2 == n:
		return 1
	return 0
n = int(input())
a = list(map(int, input().split()))
ans = -10000010
for i in range(0, n):
	if a[i] < 0 or __isPF(a[i]) == 0:
		ans = max(ans, a[i])
print(ans)


import math
n = int(input())
k = list(map(int, input().split()))
k.sort()
u = 0
for i in range(n - 1, -1, -1):
	if k[i] >= 0:
		p = math.sqrt(k[i])
		if p - int(p) != 0:
			print(k[i])
			u = 1
			break
	elif k[i] < 0:
		print(k[i])
		break


n = int(input())
a = sorted(map(int, input().split()))
for i in reversed(a):
	if i < 0 or int(i ** 0.5) ** 2 != i:
		print(i)
		break


input()
l = list(map(int, input().split()))
l.sort(reverse=True)
sq = [x * x for x in range(1001)]
l = [x for x in l if x not in sq]
print(l[0])


from math import sqrt, ceil
n = int(input())
lst = list(map(int, input().split()))
ans = []
for i in range(n):
	if lst[i] < 0:
		ans.append(lst[i])
		continue
	if sqrt(lst[i]) != int(sqrt(lst[i])):
		ans.append(lst[i])
print(max(ans))


import math
input()
n = list(map(int, input().split(' ')))
n.sort()
n.reverse()
for i in range(len(n)):
	if n[i] < 0:
		print(n[i])
		exit(0)
	v = math.sqrt(n[i])
	if v - int(v) != 0:
		print(n[i])
		exit(0)


n = int(input())
a = list(filter(lambda x: x < 0 or pow(int(x ** 0.5), 2) != x, map(int, input().split())))
a.sort()
print(a[-1])


n = int(input())
l = sorted(list(map(int, input().split())), reverse=True)
import math

def solve(l):
	for x in l:
		if x < 0:
			return x
		s = math.ceil(math.sqrt(x))
		if s * s != x:
			return x
print(solve(l))


from math import sqrt

def is_perfect(n):
	return int(sqrt(n)) == sqrt(n)
n = int(input())
A = [int(a) for a in input().split()]
A.sort(reverse=True)
for i in range(n):
	if A[i] >= 0:
		if not is_perfect(A[i]):
			print(A[i])
			break
	else:
		print(A[i])
		break


from math import sqrt

def solve(a, n):
	max_val = -100000000000000
	for i in a:
		if i < 0:
			if i > max_val:
				max_val = i
		elif not sqrt(i).is_integer() and i > max_val:
			max_val = i
	return max_val

def main():
	n = int(input())
	a = list(map(int, input().split(' ')))
	print(solve(a, n))
main()


(n, N) = (input(), [int(n) for n in input().split()])
a = N[0]
for i in N:
	if i < a:
		a = i
for i in N:
	if i > a:
		if i >= 0 and i == int(i ** 0.5) ** 2:
			pass
		else:
			a = i
print(a)


import math
mp = 0
mo = 0
n = int(input())
a = input().split()
a = [int(i) for i in a]
ot = []
a = sorted(a)
for j in range(len(a)):
	if a[j] < 0:
		ot.append(a[j])
	else:
		break
a.reverse()
if len(ot) > 0:
	mo = max(ot)
for i in range(len(a)):
	if a[i] > 0:
		s = math.sqrt(abs(a[i]))
		k = int(s)
		if s != k:
			mp = a[i]
			break
if mp != 0:
	print(mp)
else:
	print(mo)


n = int(input())
mas = list(map(int, input().split()))
Max = -100000000
for i in mas:
	if i > 0 and int(pow(i, 0.5)) ** 2 != i:
		Max = max(Max, i)
	elif i < 0:
		Max = max(Max, i)
print(Max)


import math
ans = -1000000
n = int(input())
nums = [int(x) for x in input().split()]
for num in nums:
	if num < 0:
		ans = max(ans, num)
	else:
		k = 0
		while k * k < num:
			k += 1
		if k * k != num:
			ans = max(ans, num)
print(ans)


def isqrt(n):
	if n < 0:
		return None
	elif 0 <= n <= 1:
		return n
	x = n // 2
	seen = set([x])
	while x * x != n:
		x = (x + n // x) // 2
		if x in seen:
			return None
		seen.add(x)
	return x

def is_square(n):
	return isqrt(n) is not None
n = int(input())
a = [int(v) for v in input().split()]
print(max((v for v in a if not is_square(v))))


n = int(input())
a = [int(i) for i in input().split()]
a = sorted(a)
max_ = 0
for i in range(n):
	if a[i] >= 0:
		if a[i] ** 0.5 != int(a[i] ** 0.5):
			max_ = a[i]
if max_ != 0:
	print(max_)
else:
	for i in range(n):
		if a[i] < 0:
			max_ = a[i]
	print(max_)


n = int(input())
a = set(map(int, input().split()))
b = set((x * x for x in range(1001)))
print(max(a - b))


n = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
for i in a:
	if i >= 0:
		x = int(i ** 0.5)
		if x * x != i:
			print(i)
			break
	elif i < 0:
		print(i)
		break


import math
n = int(input())
l = list(map(int, input().split()))
ans = -1000006
for i in range(n):
	sq = int(math.sqrt(abs(l[i])))
	if sq * sq != l[i]:
		ans = max(ans, l[i])
print(ans)


import math
n = int(input())
l = [int(x) for x in input().split()]
M = M2 = -1000000.0 - 7
flag = 0
for i in range(n):
	if l[i] >= 0:
		if len(str(math.sqrt(l[i]))) >= 7:
			M = max(M, l[i])
			flag = 1
	else:
		M2 = max(M2, l[i])
if not flag:
	print(M2)
else:
	print(M)


sn = set([x * x for x in range(1001)])
n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
for i in range(n):
	if a[i] not in sn:
		print(a[i])
		break


import math
n = int(input())
a = [int(x) for x in input().split()]
res = -math.inf
for i in range(n):
	if a[i] < 0 or int(math.sqrt(a[i])) ** 2 != a[i]:
		res = max(res, a[i])
print(res)


n = int(input())
nums = map(int, input().split())
lul_nums = []
for i in nums:
	if i > 0:
		if i ** (1 / 2) - int(i ** (1 / 2)) != 0:
			lul_nums.append(i)
	if i < 0:
		check = -i
		if i ** (1 / 2) + int(check ** (1 / 2)) != 0:
			lul_nums.append(i)
print(max(lul_nums))


import math
n = int(input())
ans = -10 ** 6 - 1
for x in list(map(int, input().split())):
	if x < 0:
		ans = max(ans, x)
	else:
		r = round(math.sqrt(x))
		if r * r != x:
			ans = max(ans, x)
print(ans)


import math
n = int(input())
a = [int(x) for x in input().split(' ')]
a.sort(reverse=True)
for item in a:
	if item < 0 or math.floor(math.sqrt(item)) ** 2 != item:
		ans = item
		break
print(ans)


n = int(input().strip())
ns = list(map(int, input().strip().split()))
from math import floor
ns.sort(reverse=True)

def sq(x):
	return floor(x ** 0.5) ** 2 == x
for n in ns:
	if n < 0 or not sq(n):
		print(n)
		break


n = int(input())
ar = list(map(int, input().split()))
ar = sorted(ar, reverse=True)
ans = 0
for i in ar:
	if i < 0:
		ans = i
		break
	if i ** 0.5 != int(i ** 0.5):
		ans = i
		break
print(ans)


import math

def is_square(n):
	if n < 0:
		return False
	return math.sqrt(n).is_integer()
n = int(input())
a = [int(i) for i in input().split()]
m = max([i for i in a if not is_square(i)])
print(m)


from math import sqrt as s
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
for i in range(n):
	if a[i] >= 0:
		if int(s(a[i])) * int(s(a[i])) == a[i]:
			pass
		else:
			print(a[i])
			break
	else:
		print(a[i])
		break


n = input()
a = list(map(int, input().split()))
result = -10000000
for i in a:
	if i < 0:
		result = max(result, i)
		continue
	if not i ** (1 / 2) == round(i ** (1 / 2)):
		result = max(i, result)
print(result)


a = []
for i in range(0, 1001):
	a.append(i * i)
n = int(input())
b = list(map(int, input().split()))
b.sort()
for i in b[::-1]:
	if not i in a:
		print(i)
		break


from math import sqrt
n = int(input())
s = [int(x) for x in input().split()]
maxi = -1000001
for i in range(n):
	if s[i] > maxi:
		if s[i] < 0:
			maxi = s[i]
		elif sqrt(s[i]) != int(sqrt(s[i])):
			maxi = s[i]
print(maxi)


import math
_ = input()
r = list(map(int, input().split()))
r = sorted(r, reverse=True)
for x in r:
	p = int(math.sqrt(abs(x)))
	if p * p != x:
		print(x)
		break


import math
import sys
lines = [l.strip() for l in sys.stdin.readlines()]
values = [int(v) for v in lines[1].split()]
best = -10000000.0
for value in values:
	if value < 0 or int(math.sqrt(value)) ** 2 != value:
		best = max(best, value)
print(best)


import math
n = int(input())
x = list(map(int, input().split()))
count = -1000001
for i in range(n):
	if x[i] < 0 or math.sqrt(x[i]) != int(math.sqrt(x[i])):
		count = max(count, x[i])
print(count)


n = int(input())
a = list(map(int, input().split()))
max = -1000001
for i in a:
	if i < 0 and max < i:
		max = i
	elif i > 0 and int(i ** 0.5) != i ** 0.5 and (max < i):
		max = i
print(max)


import math
N = int(input())
L = list(map(int, input().split(' ')))
L = sorted(L)
L1 = L[::-1]
for i in range(0, N):
	R1 = L1[i]
	if R1 < 0:
		R1 = R1 * -1
	R = int(math.sqrt(R1))
	if R * R != L1[i]:
		result = L1[i]
		break
print(result)


import math
n = int(input())
a = list(map(int, input().split()))
l = []
for i in a:
	if i > 0 and math.sqrt(i) != int(math.sqrt(i)):
		l.append(i)
	elif i < 0:
		l.append(i)
print(max(l))


n = int(input())
a = list(map(int, input().split()))
m = -10 ** 6
for x in a:
	p = 0
	while p * p < x:
		p += 1
	if p * p != x:
		m = max(m, x)
print(m)


import math
n = int(input())
a = [int(a) for a in input().split()]
a.sort()
for i in a:
	if i < 0:
		ps = i
	else:
		x = math.sqrt(i)
		if x != int(x):
			ps = i
print(ps)


import math
n = int(input())
l = list(map(int, input().split()))
a = []
for i in l:
	if i < 0:
		a.append(i)
		continue
	r = math.sqrt(i)
	if int(r + 0.5) ** 2 != i:
		a.append(i)
print(max(a))


from math import sqrt
read = lambda : map(int, input().split())
n = int(input())
a = list(read())
a.sort()
r = 0
for _ in a:
	if _ < 0:
		r = _
		continue
	__ = sqrt(_)
	if __ != int(__):
		r = _
print(r)


n = int(input())
a = list(map(int, input().split()))
maxi = -9999999999
for e in a:
	if e < 0:
		maxi = max(maxi, e)
	elif e ** 0.5 != int(e ** 0.5):
		maxi = max(maxi, e)
print(maxi)


import sys, math
DEBUG = False

def ni():
	return int(input())

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

def log(x):
	if DEBUG:
		print(x)
if DEBUG:
	sys.stdin = open('a.in')
n = ni()
a = nia()
log(n)
log(a)
a.sort(reverse=True)

def isPerfect(n):
	if n < 0:
		return True
	n2 = math.sqrt(n)
	n2int = int(n2)
	return n2int != n2
for i in a:
	if isPerfect(i):
		print(i)
		sys.exit()


n = int(input())
l = sorted(list(map(int, input().split())))
for i in range(n - 1, -1, -1):
	key = l[i]
	if key < 0:
		print(key)
		exit()
	if int(key ** 0.5) ** 2 != key:
		print(key)
		exit()


import math

def perfect_square():
	total = int(input())
	numbers = list(map(int, input().split()))
	output = min(numbers)
	for i in range(len(numbers)):
		if numbers[i] < 0:
			if numbers[i] > output:
				output = numbers[i]
		else:
			temp = int(math.sqrt(numbers[i]))
			if temp * temp != numbers[i]:
				if numbers[i] > output:
					output = numbers[i]
	return output
A = perfect_square()
print(A)


n = int(input())
a = [int(i) for i in input().split()]
i = 0
kv = []
ans = -100000000
for i in range(1001):
	kv.append(i * i)
for i in range(n):
	if not a[i] in kv:
		if ans < a[i]:
			ans = a[i]
	if a[i] < 0:
		if ans < a[i]:
			ans = a[i]
print(ans)


def perfect(n):
	n = sorted(n)
	n = n[::-1]
	for x in n:
		if x < 0:
			return x
		if x ** 0.5 != int(x ** 0.5):
			return x
s = int(input())
n = list(map(int, input().split()))
print(perfect(n))


n = int(input())
res = -10 ** 6 - 1
for x in list(map(int, input().split())):
	if x < 0 or (x > res and x ** 0.5 != int(x ** 0.5)):
		res = max(res, x)
print(res)