#K14741. Find the Missing Number
Find the Missing Number
Find the Missing Number
You are given a list of unique integers which contains numbers from 1 to n except one missing number. Your task is to find the missing number. This problem can be solved by using the formula for the sum of the first n natural numbers in \(\frac{n(n+1)}{2}\).
For example, if the list is [3, 7, 1, 2, 8, 4, 5], then the missing number is 6 because the total count should be 8.
inputFormat
The input is read from standard input. The first line contains an integer k, which is the number of elements in the list. The second line contains k space-separated integers — the elements of the list.
outputFormat
Output a single integer — the missing number in the range from 1 to k+1.
## sample1
1
2