A class has $N$ students labelled from $1$ to $N$. On the first day of school, the teacher collects an attendance list containing $N$ roll numbers. Determine whether the attendance list contains each roll number from $1$ to $N$ exactly once (i.e. there is 100% attendance without duplicate or missing numbers).
Input
The first line contains one integer $N$.
The next line contains $N$ integers $a_1, a_2, a_3, \dots a_N$ $-$ the recorded roll numbers.
Output
Output Yes if the attendance list contains each roll number exactly once (i.e. a perfect permutation of $1$ to $N$ where each number appears exactly once), otherwise output No.
Constraints
For all cases, $1\le a_i, N \le 10^4$ for all $1\le i\le N$.
Sample Test Cases
| Input | Output | |
|---|---|---|
| 5 2 3 1 5 4 |
Yes | |
| 4 4 1 9 1 |
No |
Scoring: Per Subtask
Authored by hclee
Appeared in 2025 Wah Yan Interschool Olympiad in Informatics 🤯🥷⚡🧠🏆