#include <bits/stdc++.h>
using namespace std;
map<string, int> mp;
string s;
int x[100];
vector<int> r;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i];
    r.push_back(x[i]);
  }
  for (int i = 0; i < n - 1; i++) {
    int ind = 0, ma = r[0];
    vector<int> tmp;
    for (int i = 1; i < r.size(); i++) {
      int diff = abs(r[i] - r[i - 1]);
      if (diff >= 2) {
        cout << "NO" << endl;
        return 0;
      } else {
        if (ma < r[i]) {
          ind = i;
          ma = r[i];
        }
      }
    }
    for (int i = 0; i < r.size(); i++) {
      if (i == ind) continue;
      tmp.push_back(r[i]);
    }
    r = tmp;
  }
  cout << "YES" << endl;
  return 0;
}
