Source Code
while True:
    x = int(input())
    if x >=1 and x <=10**5:
        break
list = []
for i in range(x):
    list.append(int(input()))

flag = True
for i in range(len(list)-1):
    if list [i] > list[i+1]:
        flag = False
        break
      

if flag:
    print("YES")
else:
    print("NO")
Copy
Anton Can't See (⊙︿⊙)_/¯ massoud01
Python 3
17 ms
2.8 MB
Runtime Error