#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const string FILENAME = "";
constexpr bool FILE_IO = 1;
constexpr int INF = int(1e9) + 7;
constexpr int MAXN = int(1e5) + 1;
bool solve() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  while (v.size() > 1) {
    for (int i = 1; i < v.size(); ++i) {
      if (abs(v[i] - v[i - 1]) >= 2) {
        return false;
      }
    }
    v.erase(max_element(v.begin(), v.end()));
  }
  return true;
}
void init() {
  if (!FILENAME.empty()) {
    freopen((FILENAME + ".in").c_str(), "r", stdin);
    freopen((FILENAME + ".out").c_str(), "w", stdout);
  }
  cout << fixed;
  cout << setprecision(10);
}
int main() {
  auto begin = chrono::steady_clock::now();
  init();
  cout << (solve() ? "YES" : "NO");
  auto end = chrono::steady_clock::now();
  cerr << "Elapsed time (ms): "
       << chrono::duration_cast<chrono::milliseconds>(end - begin).count()
       << endl;
  return 0;
}
