package yukicoder; import java.util.*; import javax.swing.plaf.synth.SynthScrollBarUI; public class Q100 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] a = new int[N]; for (int i = 0; i < N; ++i) { a[i] = sc.nextInt() - 1; } boolean[] vis = new boolean[N]; int[] loopSize = new int[N + 1]; for (int i = 0; i < N; ++i) { if (!vis[i]) { int count = 1; int cur = i; vis[cur] = true; while (!vis[a[cur]]) { cur = a[cur]; vis[cur] = true; ++count; } ++loopSize[count]; } } for (int i = 1; i <= N; ++i) { if (i % 2 == 0 && loopSize[i] > 0) { if (loopSize[i] % 2 == 1) { System.out.println("No"); return; } } } System.out.println("Yes"); } static void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }