#include #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep1(i,n) for(int i=1;i<=(int)(n);i++) #define all(c) c.begin(),c.end() #define pb push_back #define fs first #define sc second #define show(x) cout << #x << " = " << x << endl #define chmin(x,y) x=min(x,y) #define chmax(x,y) x=max(x,y) using namespace std; int N,a[50]; bool vis[50]; int c; void dfs(int x){ if(vis[x]) return; c++; vis[x]=1; dfs(a[x]); } int cnt[51]; int main(){ cin>>N; rep(i,N) cin>>a[i],a[i]--; rep(i,N) if(!vis[i]){ c=0; dfs(i); cnt[c]++; } rep(i,51) if(i%2==0&&cnt[i]%2==1){ puts("No"); return 0; } puts("Yes"); }