#C14667. Find First Non-Consecutive Element

    ID: 44341 Type: Default 1000ms 256MiB

Find First Non-Consecutive Element

Find First Non-Consecutive Element

You are given a list of integers sorted in increasing order. The numbers are expected to be consecutive, i.e., each number should be exactly one more than its predecessor. Your task is to find the first element in the sequence that does not follow this consecutive order. If every element in the list is consecutive (or if the list contains only one element), output None.

Note: The consecutive property can be mathematically described as follows: for every valid index \(i\) (with \(1 \le i < n\)), the condition \(a_{i} = a_{i-1} + 1\) must hold. If this condition is violated, then \(a_i\) is the answer.

inputFormat

The input is read from standard input and contains two lines:

  1. The first line contains a single integer \(n\) denoting the number of elements in the list.
  2. The second line contains \(n\) space-separated integers representing the elements of the list.

outputFormat

Output a single line to standard output containing the first non-consecutive element. If all elements are consecutive (or if the list has only one element), print None.

## sample
4
1 2 3 4
None

</p>