#C13396. Find the Missing Number

    ID: 42929 Type: Default 1000ms 256MiB

Find the Missing Number

Find the Missing Number

You are given a list of unique integers that represents numbers from 1 to N with exactly one number missing. Your task is to find the missing number.

The missing number can be calculated using the formula: $$Missing = \frac{N(N+1)}{2} - \sum_{i=1}^{N-1}a_i.$$

Read the input from stdin and output the result to stdout.

inputFormat

A single line of input containing space-separated integers representing the numbers from the list. The list is from 1 to N (with one missing number), so the number of integers given is N-1.

outputFormat

Output a single integer — the missing number.## sample

3 7 1 2 8 4 5
6