#include #include #include #include #include #include using namespace std; #define int __int128 #define endl "\n" const long long INF = (long long)1e18; const int MOD = 1'000'000'007; string yn(bool f){return f?"Yes":"No";} string YN(bool f){return f?"YES":"NO";} long long power(long long x, long long n){ long long ans = 1; int N = n; if(x == 0) return 1; if(x >= 4) return -1; n = 1; for(int i = 1; i <= N; i++){ n *= i; } // cout<<"n = "<>= 1, x *= x) { if(n&1)ans*=x; if(ans > MOD) return -1; } return ans; } signed main(){ long long N; int zero = 0; int ans = 1; vector A; cin>>N; A.resize(N); for(int i = 0; i < N; i++){ cin>>A[i]; } for(int i = 0; i < N; i++){ int t = power(A[i], A[i]); if(t == -1) { if(ans == 0){ cout<<-1< MOD) { // exit(2); if(ans == 0){ cout<<-1<