#include <stdio.h>
#include<math.h>
int judge_name(int num, int max, int min, int* map)
{
    for (int i = max; i >= min; i--)
    {
        if (map[i] == 1)
        {
            double judge = sqrt((double)i);
            if (judge != (int)judge)
            {
                return i;
            }
        }
    }
    return 0;
}

int main() 
{
    int n = 0;
    scanf("%d", &n);
    int num = 0;

    int map[100000];
    int max = 0;//定位最大值
    int min = 100000;//定位最小值
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &num);
        map[num] = 1;
        if (num > max)
        {
            max = num;
        }
        if (num < min)
        {
            min = num;
        }
    }

    int ret = judge_name(num, max, min, map);
    //输出
    printf("%d\n", ret);


    return 0;
}