#include int N, A[51], count[51]; bool used[51]; int main(){ scanf("%d", &N); for(int i=1;i<=N;i++){ scanf("%d", A+i); } for(int i=1;i<=N;i++){ if(used[i]){continue;} int t = 1; for(int j=A[i];j!=i;j=A[j]){used[j] = true; t++;} count[t]++; } for(int i=2;i<=N;i+=2){ if(count[i] & 1){puts("No"); return 0;} } puts("Yes"); }