#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1000000 + 100;
int A[Maxn];
int Vis[10000000 + 100];
int N;
inline int cmp(int x, int y) { return x > y; }
int main() {
  for (int i = 0; i <= 1000; ++i) Vis[i * i] = 1;
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) scanf("%d", &A[i]);
  sort(A + 1, A + N + 1, cmp);
  for (int i = 1; i <= N; ++i) {
    if (A[i] < 0) {
      cout << A[i] << endl;
      return 0;
    }
    if (!Vis[A[i]]) {
      cout << A[i] << endl;
      return 0;
    }
  }
  return 0;
}

### Prompt

Generate a CPP solution to the following problem:

Given an array a1, a2, ..., an 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 = y2.

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 a1, a2, ..., an ( - 106 ≤ ai ≤ 106) — 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.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1000000 + 100;
int A[Maxn];
int Vis[10000000 + 100];
int N;
inline int cmp(int x, int y) { return x > y; }
int main() {
  for (int i = 0; i <= 1000; ++i) Vis[i * i] = 1;
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) scanf("%d", &A[i]);
  sort(A + 1, A + N + 1, cmp);
  for (int i = 1; i <= N; ++i) {
    if (A[i] < 0) {
      cout << A[i] << endl;
      return 0;
    }
    if (!Vis[A[i]]) {
      cout << A[i] << endl;
      return 0;
    }
  }
  return 0;
}

```