import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!int).array;

    bool[int] S;
    for (int i = 0; i * i <= 10^^6; ++i) {
        S[i*i] = true;
    }

    int ans = -(10^^6)-1;
    foreach (a; A) if (!(a in S)) ans = max(ans, a);

    ans.writeln;
}
