75. The Missing Roll Number

Acceptance — 0 accepted 0 submissions

Easy
ArraysMath
No companies listed
A class has n students with roll numbers 1 to n. One student is absent today. The teacher has the jumbled list of the n - 1 students who are present.

Find the absent student's roll number.

Input Format
The first line has n.
The second line has n - 1 distinct integers from 1 to n.

Output Format
Print the missing roll number.

Constraints
• 2 ≤ n ≤ 10^5

Example 1

Input
5
3 1 5 2
Output
4

Explanation 1+2+3+4+5 = 15. Present sum = 11. Missing = 4.

Example 2

Input
2
2
Output
1

Explanation Only roll number 1 is missing.

Example 3

Input
4
1 2 3
Output
4

Explanation The last roll number is missing.

Acceptance —
Accepted 0
Submissions 0
Auto-save
Saved Ln 1, Col 1
Submit a solution to see its status here.
Input
Expected Output
4
No results yet
Run your code to test it against the sample cases.
Problem List