Chef has given you N numbers in an array A and asks you if the array is beautiful or not.

An array is said to be beautiful if there exists at least one pair (i, j) such that

i < j and A[i] <= A[j]

If the array is beautiful then print “YES”, otherwise “NO”.

Thank you for the answer. This is what I need. You helped me solve my problem.