#include <iostream>

using namespace std;

int rb_queue(int n, int* arr, int* arr1);

int main()
{
    int n;
    cin >> n;
    int arr[1000] = { 0 };
    int arr1[1000] = { 0 };
    int max;
    max = rb_queue(n, arr, arr1);
    cout << max << endl;
    return 0;
}

int rb_queue(int n, int* arr, int* arr1)
{
    int count = 0;
    int flag = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 1; j < arr[i]; j++)
        {
            if (arr[i] == j * j)
            {
                flag = 1;
                break;
            }
        }
        if (flag == 1)
        {
            flag = 0;
            continue;
        }
        else
        {
            arr1[count] = arr[i];
            count++;
        }
    }
    int max = arr1[0];
    for (int i = 1; i < n; i++)
    {
        if (max <= arr1[i])
        {
            max = arr1[i];
        }
    }
    return max;
}