#K35982. Strict Sequence Checker

    ID: 25652 Type: Default 1000ms 256MiB

Strict Sequence Checker

Strict Sequence Checker

You are given a sequence of integers and need to determine whether the sequence is strictly monotonic, i.e., either strictly increasing or strictly decreasing. A sequence ( a_1, a_2, \ldots, a_n ) is strictly increasing if ( a_i < a_{i+1} ) for all ( 1 \leq i < n ), and strictly decreasing if ( a_i > a_{i+1} ) for all ( 1 \leq i < n ). By definition, an empty sequence or a sequence with a single element is considered strictly monotonic.

Your task is to read the input from standard input and output ( True ) if the sequence is strictly increasing or strictly decreasing, and ( False ) otherwise.

inputFormat

The input consists of two lines. The first line contains a single integer ( n ) (( 0 \leq n \leq 10^5 )), representing the number of elements in the sequence. The second line contains ( n ) space-separated integers representing the sequence. If ( n = 0 ), the second line may be omitted.

outputFormat

Output a single line containing either ( True ) if the sequence is strictly increasing or strictly decreasing, or ( False ) otherwise. The output should exactly match one of these two strings.## sample

4
1 2 3 4
True

</p>