Problem9389--ABC205 —— B - Permutation Check

9389: ABC205 —— B - Permutation Check

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 512 MiB

Description

You are given a sequence of $N$ integers between $1$ and $N$ (inclusive): $A = (A_1, A_2, \dots, A_N)$.

Determine whether $A$ is a permutation of $(1, 2, \dots, N)$.

Input

Input is given from Standard Input in the following format:

```
$N$
$A_1$ $A_2$ $\ldots$ $A_N$
```

Output

If $A$ is a permutation of $(1, 2, \dots, N)$, print `Yes`; otherwise, print `No`.

Constraints

-   $1 \leq N \leq 10^3$
-   $1 \leq A_i \leq N$
-   All values in input are integers.

Sample 1 Input

5
3 1 2 4 5

Sample 1 Output

Yes
(3,1,2,4,5) is a permutation of (1,2,3,4,5), so we should print Yes.

Sample 2 Input

6
3 1 4 1 5 2

Sample 2 Output

No
(3,1,4,1,5,2) is not a permutation of (1,2,3,4,5,6), so we should print No.

Sample 3 Input

3
1 2 3

Sample 3 Output

Yes

1
1

Yes

Source/Category