RAHIA - Riyad And His Increasing Array

no tags 

You are given an array of N integers.

In this array in a single operation, you can choose any i (where 1 <= i <= N) such that a[i]>0 and decrease a[i] by 1.

You have to determine is it possible to make the given array sorted (strictly increasing) after using some number of operations (possibly 0) described above.

Input

Input starts with an integer N (1 ≤ N ≤ 100000), number of elements of the array.

Next line contains N separated integers ai (1 ≤ ai ≤ 109).

Output

Print "YES" (without quotes), if you can make the array sorted (strictly increasing), otherwise print "NO".

Example

Input:
7
5 2 3 9 88 9 10

Output:
YES

hide comments
mestu_paul: 2020-02-13 21:29:07

you can either decrease or not no problem

m_a_noman: 2020-02-13 18:52:52

cann't i skip any operation ???
i mean if i don't want decrease the value of a[i] , then is there any problem happened in the judging queue ????


Added by:Riyad
Date:2020-02-06
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:BASH C NCSHARP C++ 4.3.2 CPP CPP14 C99 FORTRAN JULIA PYTHON PYPY3 PYTHON3 RUBY
Resource:none