#K56947. Check Sorted Order

    ID: 30311 Type: Default 1000ms 256MiB

Check Sorted Order

Check Sorted Order

Given an integer (n) representing the number of elements in an array and the array itself, determine whether the array is sorted in non-decreasing order. If the array is sorted, output Sorted; otherwise, output Unsorted.

In mathematical terms, for an array (a_1, a_2, \ldots, a_n), check whether (a_i \leq a_{i+1}) holds for all (1 \leq i < n).

inputFormat

The input consists of two lines:
1. The first line contains an integer (n) (where (1 \leq n \leq 10^5)), the number of elements in the array.
2. The second line contains (n) space-separated integers (a_1, a_2, \ldots, a_n) (each satisfying (-10^5 \leq a_i \leq 10^5)).

outputFormat

Output a single line containing Sorted if the array is in non-decreasing order, or Unsorted otherwise.## sample

5
1 2 3 4 5
Sorted

</p>