#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, mx = 0, mx2;
  bool flag = false, f2 = false;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (a < 0) {
      if (!f2)
        f2 = true, mx2 = a;
      else
        mx2 = max(a, mx2);
    } else {
      double temp = sqrt(a), t2 = ceil(sqrt(a));
      if (t2 != temp && a >= mx) mx = a, flag = true;
    }
  }
  if (flag)
    cout << mx << endl;
  else
    cout << mx2 << endl;
  return 0;
}
