Answer:
is_sorted = True
sequence = input("")
data = sequence.split()
count = int(data[0])
for i in range(1, count):
if int(data[i]) >= int(data[i+1]):
is_sorted = False
break
if is_sorted:
print("Sorted")
else:
print("Unsorted")
Explanation:
*The code is in Python.
Initialize a variable named is_sorted as True. This variable will be used as a flag if the values are not sorted
Ask the user to enter the input (Since it is not stated, I assumed the values will be entered in one line each having a space between)
Split the input using split method
Since the first indicates the number of integers, set it as count (Note that I converted the value to an int)
Create a for loop. Inside the loop, check if the current value is greater than or equal to the next value, update the is_sorted as False because this implies the values are not sorted (Note that again, I converted the values to an int). Also, stop the loop using break
When the loop is done, check the is_sorted. If it is True, print "Sorted". Otherwise, print "Unsorted"