#include using namespace std; int n, a[50], b[51]; // b[j] := 大きさ j のループの個数 int loop_size(int i) { if (a[i] == -1) return 0; int next = a[i]; a[i] = -1; return loop_size(next) + 1; } bool solve() { for (int i = 0; i < n; i++) if (a[i] != -1) b[loop_size(i)]++; // 偶数サイズのループが奇数個あれば false for (int j = 2; j <= n; j += 2) if (b[j] % 2 == 1) return false; return true; } int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; a[i]--; } cout << (solve() ? "Yes" : "No") << endl; }