#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> a;
bool check() {
  for (size_t i = 0; i < n - 1; ++i) {
    if (std::abs(a[i] - a[i + 1]) >= 2) return false;
  }
  return true;
}
int main() {
  cin >> n;
  a.resize(n);
  for (size_t i = 0; i != n; ++i) {
    cin >> a[i];
  }
  while (a.size()) {
    if (!check()) {
      cout << "NO";
      exit(EXIT_SUCCESS);
    }
    vector<int>::iterator mx = a.begin();
    for (vector<int>::iterator i = a.begin() + 1; i < a.end(); ++i) {
      if (*i > *mx) mx = i;
    }
    a.erase(mx);
  }
  cout << "YES";
  return 0;
}
