#K89432. Find the Missing Number
Find the Missing Number
Find the Missing Number
Given an integer \( n \) and an array of \( n-1 \) unique integers from 1 to \( n \), one integer is missing. You are required to determine the missing integer. Recall that the sum of the first \( n \) natural numbers is given by \( \frac{n(n+1)}{2} \), so the missing number can be computed by subtracting the sum of the array from this total.
Example:
Input: 5 1 2 4 5</p>Output: 3
In the above example, the total sum from 1 to 5 is \(15\), and the sum of the given numbers is \(12\). Thus, the missing number is \(15 - 12 = 3\).
inputFormat
The input is provided via standard input (stdin) in the following format:
- The first line contains a single integer \( n \), representing the range of numbers from 1 to \( n \).
- The second line contains \( n-1 \) space-separated integers, representing the array of numbers with one missing element.
outputFormat
The output should be printed to standard output (stdout) and must be a single integer representing the missing number.
## sample5
1 2 4 5
3
</p>