#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; long long inversion_number(vector &A){ int N = A.size(); vector B = A; sort(B.begin(), B.end()); map mp; for (int i = 0; i < N; i++) mp[B[i]] = i + 1; for (int i = 0; i < N; i++) A[i] = mp[A[i]]; long long ans = 0; vector BIT(N + 1, 0); for (int i = 0; i < N; i++){ ans += i; int j; j = A[i]; while (j > 0){ ans -= BIT[j]; j -= j & -j; } j = A[i]; while (j <= N){ BIT[j]++; j += j & -j; } } return ans; } int main(){ cin.tie(0); ios::sync_with_stdio(0); int N; cin >> N; vector A(N); rep(i,N) cin >> A[i]; cout << (inversion_number(A) % 2 == 0 ? +1 : -1) << endl; }