#K89422. Consecutive Weights

    ID: 37527 Type: Default 1000ms 256MiB

Consecutive Weights

Consecutive Weights

You are given a list of integer weights. Your task is to determine whether the weights form a sequence of consecutive integers.

The weights are considered consecutive if, after sorting them, the difference between every two adjacent numbers is exactly 1. For instance, the sequence \(5, 6, 7, 8\) is consecutive, while \(1, 2, 4, 5\) is not. Note that an empty list should be considered non-consecutive, and a list with a single element is considered consecutive.

Input/Output Requirements: The input will be read from standard input (stdin) and the output should be printed to standard output (stdout). Ensure your program handles edge cases properly.

inputFormat

The first line of input contains an integer \(n\), representing the number of weights. The second line contains \(n\) space-separated integers representing the weights.

outputFormat

Output a single line: True if the list of weights forms a sequence of consecutive integers; otherwise, output False.

## sample
4
5 6 7 8
True