#K53312. Find the Missing Number in a Sequence

    ID: 29504 Type: Default 1000ms 256MiB

Find the Missing Number in a Sequence

Find the Missing Number in a Sequence

Given a list of integers representing a sequence of numbers from 1 to \(n\) with exactly one number missing, your task is to identify the missing number.

The complete sequence from 1 to \(n\) has a sum given by the formula: \( S = \frac{n(n+1)}{2} \). By subtracting the sum of the given numbers from \(S\), you can obtain the missing number.

This problem is straightforward and tests your ability to apply basic arithmetic operations and handling of input/output from standard streams.

inputFormat

The input is given via stdin and consists of two lines:

  1. The first line contains an integer \(T\), representing the number of integers provided in the list.
  2. The second line contains \(T\) space-separated integers representing the list.

outputFormat

Output a single integer to stdout which is the missing number in the sequence from 1 to \(T+1\).

## sample
5
1 2 4 5 6
3