#include <bits/stdc++.h>
using namespace std;
int main() {
  list<int> lst;
  list<int>::iterator prev;
  list<int>::iterator it;
  list<int>::iterator itmx;
  int n, x;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    lst.push_back(x);
  }
  while (lst.size()) {
    prev = lst.begin();
    itmx = lst.begin();
    for (it = lst.begin(); it != lst.end(); it++) {
      if (abs(*it - *prev) >= 2) {
        cout << "NO";
        return 0;
      }
      if (*it > *itmx) {
        itmx = it;
      }
      prev = it;
    }
    lst.erase(itmx);
  }
  cout << "YES";
}
