#C14587. Check if List is Sorted

    ID: 44252 Type: Default 1000ms 256MiB

Check if List is Sorted

Check if List is Sorted

Given a list of integers, you are to determine whether the list is sorted in non-decreasing (ascending) order. Specifically, the list is considered sorted if every element is less than or equal to the element that comes after it. For example, the list [1, 2, 3, 4, 5] is sorted, while the list [3, 2, 1] is not.

The solution should read the input from standard input (stdin) and output the answer to standard output (stdout). The output should be exactly True if the list is sorted, and False otherwise.

The mathematical condition for a list lst of length n to be sorted is given by the following LaTeX equation:

\( \forall i \in \{1, 2, \dots, n-1\}, \quad lst[i] \leq lst[i+1] \).

inputFormat

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

outputFormat

Output a single line containing either True if the list is sorted in non-decreasing order, or False otherwise.

## sample
5
1 2 3 4 5
True