#K61387. Find the Missing Number
Find the Missing Number
Find the Missing Number
You are given a list of unique integers which contains numbers in the range from 1 to n (inclusive) with exactly one number missing. Your task is to determine the missing number.
Input: A single line containing a sequence of space-separated integers representing the list with one number missing. The list is unsorted.
Output: Output the missing integer.
The problem can be solved using the formula for the sum of the first n natural numbers in latex format as follows:
$$ S = \frac{n \times (n+1)}{2} $$
Subtract the sum of the given numbers from \(S\) to obtain the missing number.
inputFormat
The input consists of a single line read from stdin containing space separated integers. These integers represent the numbers from 1 to \(n\) with one number missing. The length of the array is \(n-1\).
outputFormat
Output the missing number on a single line to stdout.
## sample1 2 4 5 6
3
</p>