#K90702. Find the Missing Number
Find the Missing Number
Find the Missing Number
You are given an array of n distinct integers taken from the set \(\{0, 1, 2, \ldots, n\}\). The array is missing exactly one number. Your task is to determine the missing number.
You can solve this problem by using the formula for the sum of the first \(n\) natural numbers: \(\frac{n(n+1)}{2}\). Calculate the expected sum of numbers from \(0\) to \(n\) and compare it with the actual sum from the input array. The difference will be the missing number.
inputFormat
The input is given in a single line from standard input. The line contains space-separated integers representing the numbers in the array. Note that the array has n numbers drawn from \(\{0, 1, \ldots, n\}\) with exactly one number missing.
outputFormat
Output the missing integer to standard output.
## sample0 1 3
2