All tasks
Mediummatharrays

Missing Number

Time limit 2 s · Memory 64 MBAcceptance: —Solved by: 0

Statement

The first line contains n. The second line contains n-1 distinct numbers from 1 to n with exactly one of them missing. Print the missing number.

Examples

Example 1
Input
5
1 2 4 5
Output
3
Example 2
Input
2
2
Output
1

Constraints

  • 2 ≤ n ≤ 10^5
Solve this task to unlock the editorial.

AI tutor

Stuck? Get a nudge — the tutor explains the idea, it never hands you the solution.