#include #include #define llint long long using namespace std; llint n; llint a[1<<18]; void zeta_transform(llint a[], int n) { int S = 1<> n; for(int i = 0; i < n; i++) cin >> a[i], a[i] = max(a[i], 0LL); zeta_transform(a, 18); for(int i = 0; i < n; i++) a[i] *= a[i]; moebius_transform(a, 18); llint ans = 0; for(int i = 0; i < n; i++) ans = gcd(ans, a[i]); if(ans == 0) ans = -1; cout << ans << endl; return 0; }