/* -*- coding: utf-8 -*- * * 100.cc: No.100 直列あみだくじ - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 50; /* typedef */ /* global variables */ int as[MAX_N]; bool used[MAX_N]; /* subroutines */ /* main */ int main() { int n; cin >> n; for (int i = 0; i < n; i++) (cin >> as[i]), as[i]--; int en = 0; for (int i = 0; i < n; i++) if (! used[i]) { used[i] = true; int l = 1; for (int j = as[i]; j != i; j = as[j]) used[j] = true, l++; if (! (l & 1)) en++; } cout << ((en & 1) ? "No" : "Yes") << endl; return 0; }