#include using namespace std; int main(){ int N; cin >> N; vector s(N+1); for(int i=1;i<=N;i++){ cin >> s[i]; } s[0] = 0; int j; int sgn_count = 0; int w; for(int i=N;i>=0;i--){ if(s[i] != i){ for(j=0;j<=N;j++){ if(s[j] == i){ break; } } w = s[i]; s[i] = s[j]; s[j] = w; sgn_count++; } } if(sgn_count %2 == 0){ cout << 1 << endl; } else { cout << -1 << endl; } }