#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
int main() {
  int s = 1000, v;
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  for (int i = 0; i <= s; i++) mp[i * i] = 1;
  int flag = 0;
  int n;
  cin >> n;
  int maxn = -1, maxx = -99999999;
  for (int i = 0; i < n; i++) {
    cin >> v;
    if (v > 0) {
      if (mp[v] != 1) {
        if (v > maxn) maxn = v;
      }
    } else if (v < 0) {
      if (v > maxx) maxx = v;
    }
  }
  if (maxn != -1)
    cout << maxn << endl;
  else
    cout << maxx << endl;
  return 0;
}
