Find the Missing Number
Given an array containing N distinct numbers from 0 to N, find the one number missing from the sequence.
Input format
The first line contains N. The second line contains N distinct integers, each between 0 and N — exactly one value in that range is missing.
Output format
Print the missing number.
Constraints
- Values fit in a 64-bit signed integer
- Trailing whitespace and a trailing newline are ignored by the judge
Read from stdin, write to stdout. Sample cases below show the exact format.
Sample cases
Example 1
Input
3
3 0 1Expected output
2Example 2
Input
1
0Expected output
1