We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

Loading...

Consider a function where is any set, and is a bijection.

Now, if then is called an *involution*. In other words, a function is called an involution if

In this task you're given a permutation .

Determine whether is an involution or not.

**Constraints**

**Input Format**

There are lines in the input.

The first line contains a single positive integer .

The second line contains space separated integers, the values of , respectively.

**Output Format**

Output "*YES*" if is an involution. Otherwise, output "*NO*".

**Sample Input**

```
2
2 1
```

**Sample Output**

```
YES
```

**Explanation**

Since, and and .

Hence, is an involution.