#include #include #include using namespace std; using ll = long long; ll gcd(ll x, ll y) { if (y == 0) return x; return gcd(y, x % y); } int main() { int N; cin >> N; vector A(N); ll g = 0; for (int i = 0; i < N; i++) { cin >> A[i]; if (A[i] != -1) { g = gcd(g, A[i]); } } if (g == 0) { cout << -1 << endl; } else { cout << g * g << endl; } }