#define _CRT_SECURE_NO_WARNINGS #include using namespace std; typedef long long ll; typedef vector vi; typedef vector vvi; typedef pair pii; #define all(c) (c).begin(), (c).end() #define loop(i,a,b) for(ll i=a; iDUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this< ostream& operator<<(ostream& os, vector const& v){ rep(i,v.size()) os << v[i] << (i+1==v.size()?"":" "); return os; } int n; int a[60]; bool used[60]; int x[60]; int main(){ while(cin >> n){ memset(x,0,sizeof x); rep(i,n){ cin >> a[i]; a[i]--; used[i] = false; } rep(i,n){ if(used[i]) continue; int j = a[i]; int c = 1; while(j!=i){ used[j] = true; j = a[j]; c++; } x[c]++; } bool ok = true; rep(i,50){ if(i%2==0 && x[i]%2!=0) ok = false; } puts(ok ? "Yes" : "No"); } }