#K47582. Missing Number Finder
Missing Number Finder
Missing Number Finder
You are given a list of distinct integers which are taken from the range 1 to n with exactly one number missing. Your task is to determine the missing number.
Note: The input list has exactly n-1 integers. The missing number is the one for which it holds: \( S=\frac{n(n+1)}{2} \) and missing number = \( S - (\text{sum of given numbers}) \).
inputFormat
The input is read from standard input (stdin) and consists of two lines:
- The first line contains a single integer n, the total count of numbers that should be present (including the missing one).
- The second line contains n-1 space-separated integers representing the list of numbers.
outputFormat
Output to standard output (stdout) a single integer representing the missing number.
## sample5
1 2 3 5
4