#include <iostream>
#include <fstream>
using namespace std;

ifstream f("bac.in");
int nrdiv(int x) {

	int nr = 0,d;
	for (d = 2; d <= x; d++)
		if (x % d == 0) {

			nr++;
			while (x % d == 0)
				x = x/d;

		}

	return nr;


}

int main() {


	int n,i,a,valoare = -1;
	f>>n;
	for (i = 0; i < n; i++){

		f>>a;
		if (nrdiv(a) % 2 == 0) {
			if (valoare == -1)
				cout<<a<<" ";
			valoare = a;
		}
	}

	cout<<valoare;

	return 0;

}