#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  int maxx = -1e6;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] < 0)
      maxx = max(maxx, a[i]);
    else if (a[i] > 0) {
      int ok = 1;
      for (int j = 1; j * j <= a[i]; j++) {
        if (j * j == a[i]) {
          ok = 0;
        }
      }
      if (ok) {
        maxx = max(maxx, a[i]);
      }
    }
  }
  cout << maxx;
}
