#include <bits/stdc++.h>
using namespace std;
bool success(vector<int>& a) {
  if (a.size() == 1) return true;
  for (int i = 0; i < a.size() - 1; ++i)
    if (abs(a[i] - a[i + 1]) >= 2) return false;
  int max = -1;
  int maxPos = -1;
  for (int i = 0; i < a.size(); ++i)
    if (a[i] > max) {
      max = a[i];
      maxPos = i;
    }
  a.erase(a.begin() + maxPos);
  return success(a);
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  bool ok = success(a);
  if (ok)
    cout << "YES";
  else
    cout << "NO";
}
