#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> vect;
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    vect.push_back(a);
  }
  while (vect.size()) {
    int maxv = -1;
    int in = -1;
    for (int i = 0; i < vect.size() - 1; i++) {
      if (abs(vect[i] - vect[i + 1]) >= 2) {
        cout << "NO";
        return 0;
      }
    }
    for (int i = 0; i < vect.size(); i++) {
      if (vect[i] > maxv) {
        in = i;
        maxv = vect[i];
      }
    }
    vect.erase(vect.begin() + in);
  }
  cout << "YES";
  return 0;
}
