#K60992. Missing Number in a Sequence

    ID: 31209 Type: Default 1000ms 256MiB

Missing Number in a Sequence

Missing Number in a Sequence

You are given an array of n-1 unique integers which are a permutation of the numbers from 1 to n except that one number is missing. Your task is to find the missing number.

For example, if the input array is [1, 2, 4, 5], then the complete sequence should be [1, 2, 3, 4, 5] and the missing number is 3.

You can use the formula for the sum of the first n natural numbers: \( S = \frac{n(n+1)}{2} \) to calculate the expected sum and subtract the sum of the given numbers to get the missing number.

inputFormat

The input is provided via standard input (stdin) as a single line containing space-separated integers. These integers represent the array of numbers with one missing element.

outputFormat

The output should be printed to standard output (stdout) as a single integer which is the missing number from the sequence.

## sample
1 2 4 5
3