Everybody knows of [spaghetti sort](https://en.wikipedia.org/wiki/Spaghetti_sort). You decided to implement an analog sorting algorithm yourself, but as you survey your pantry you realize you're out of spaghetti! The only type of pasta you have is ravioli, but you are not going to let this stop you...

You come up with the following algorithm. For each number in the array *a*<sub class="lower-index">*i*</sub>, build a stack of *a*<sub class="lower-index">*i*</sub> ravioli. The image shows the stack for *a*<sub class="lower-index">*i*</sub> = 4.

Arrange the stacks in one row in the order in which the corresponding numbers appear in the input array. Find the tallest one (if there are several stacks of maximal height, use the leftmost one). Remove it and add its height to the end of the output array. Shift the stacks in the row so that there is no gap between them. Repeat the procedure until all stacks have been removed.

At first you are very happy with your algorithm, but as you try it on more inputs you realize that it doesn't always produce the right sorted array. Turns out when two stacks of ravioli are next to each other (at any step of the process) and differ in height by two or more, the top ravioli of the taller stack slides down on top of the lower stack.

Given an input array, figure out whether the described algorithm will sort it correctly.
The first line of input contains a single number *n* (1 ≤ *n* ≤ 10) — the size of the array.

The second line of input contains *n* space-separated integers *a*<sub class="lower-index">*i*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 100) — the elements of the array.
In the second example the array will change even before the tallest stack is chosen for the first time: ravioli from stack of height 3 will slide on the stack of height 1, and the algorithm will output an array {2, 2, 2}.
3
1 2 3
YES
3
3 1 2
NO
1
13
YES
10
67 67 67 67 67 67 67 67 67 67
YES
10
16 17 16 15 14 15 16 17 16 15
YES
4
54 54 54 55
YES
3
68 67 67
YES
5
46 46 47 46 45
YES
4
14 15 15 16
YES
6
59 59 60 60 59 58
YES
3
40 40 40
YES
4
90 91 90 91
YES
10
9 9 9 10 10 9 8 8 9 9
YES
3
22 23 24
YES
9
71 71 70 70 71 70 69 70 71
YES
9
15 14 14 13 13 12 13 13 14
YES
4
61 60 60 60
YES
4
16 17 17 18
YES
6
87 86 86 86 85 86
YES
5
64 63 63 62 61
YES
9
13 80 13 38 98 85 11 73 74
NO
10
2 83 18 65 58 95 37 51 86 47
NO
6
47 100 96 2 96 43
NO
10
28 61 23 73 61 33 45 55 18 43
NO
10
95 51 52 8 44 39 77 17 96 88
NO
5
14 91 91 91 84
NO
4
92 18 29 93
NO
7
23 37 39 8 72 31 85
NO
4
61 28 3 81
NO
4
83 100 81 75
NO
9
95 7 97 61 90 7 30 65 39
NO
3
90 39 98
NO
3
76 9 12
NO
3
69 26 73
NO
10
55 39 93 42 97 40 36 38 11 97
NO
5
21 57 40 94 17
NO
7
35 91 87 78 17 71 63
NO
7
20 21 95 73 49 98 53
NO
8
46 4 30 85 52 6 84 13
NO
10
79 84 22 38 23 22 33 42 13 96
NO
#include<bits/stdc++.h>
using namespace std;
#define data_type long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    vector<data_type> arr(n);
    for(auto &i:arr)
      cin>>i;
    cout<<(is_sorted(arr.begin(),arr.end())?"YES":"NO")<<endl;




    return 0;
}
