Given an integer $$$n$$$, $$$1 <= n <= 10^5$$$, and an array $$$a$$$ consisting of $$$n$$$ elements, figure out if the array is a good array. A good array is defined to be first increasing, then decreasing. Note that an increasing array or decreasing array is a good array. An increasing array is an array such that every next element of every element(that is not the last) has to be greater than or equal to that element. A decreasing array is an array such that every next element of every element(that is not the last) has to be less than or equal to that element.
Example:
Input:
5 1 2 4 3 1
Output: YES
Input:
3 3 2 1
Output: YES
Input:
5 1 2 3 4 4
Output: YES
Input:
5 5 4 2 1 1
Output: YES