#K34357. Find the Missing Number
Find the Missing Number
Find the Missing Number
You are given an integer N and a list containing N-1 unique integers from 1 to N. One number in the range is missing. Your task is to determine the missing number.
Using the formula $$ S = \frac{N(N+1)}{2} $$ to compute the total sum of numbers from 1 to N, you can then subtract the sum of the given sequence to find the missing number.
inputFormat
The first line of input contains a single integer N, representing the size of the complete sequence. The second line contains N-1 space-separated integers which are the elements of the sequence with one number missing.
outputFormat
Output a single integer -- the missing number from the sequence.## sample
5
1 2 4 5
3
</p>