#C12434. Find The Missing Number
Find The Missing Number
Find The Missing Number
This problem requires you to find the missing number from a list of unique integers. You are given a list containing exactly n-1 distinct integers that are supposed to be all the numbers from 1 to n (inclusive). One number is missing, and your task is to identify it.
You can solve this problem by computing the expected sum of the first n natural numbers using the formula \( S = \frac{n(n+1)}{2} \) and subtracting the sum of the provided numbers from it. This problem is fundamental and tests your understanding of basic arithmetic operations along with input/output handling.
inputFormat
The input is read from standard input (stdin) and consists of exactly two lines:
- The first line contains a single integer n (the upper bound of natural numbers).
- The second line contains n-1 space-separated integers in any order, representing the list of numbers with one missing value.
outputFormat
Output a single integer to standard output (stdout), which is the missing number.
## sample5
2 3 4 5
1
</p>