#C12861. Find the Missing Number
Find the Missing Number
Find the Missing Number
You are given a list of n unique integers taken from the range \( [0, n] \) (inclusive). The list is missing exactly one number from this range. Your task is to determine which number is missing.
The complete sum of the range \( [0, n] \) can be calculated using the formula:
\( \frac{n(n+1)}{2} \)
You should implement a program that reads the input from stdin and outputs the missing number to stdout.
inputFormat
The first line of input contains an integer n, representing the number of elements in the list. The second line contains n space-separated integers which are the elements of the list.
Note that the list consists of n numbers taken from the range \( [0, n] \) with exactly one number missing.
outputFormat
Output a single integer, which is the missing number in the range.
## sample3
3 0 1
2