#include <bits/stdc++.h>
using namespace std;
int h[20];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> h[i];
  bool ok = 1;
  for (int i = 0; i < n; i++) {
    int hmax = 0;
    for (int j = 1; j <= n - i; j++) {
      if (j > 1 && abs(h[j] - h[j - 1]) >= 2) ok = 0;
      if (h[j] > h[hmax]) hmax = j;
    }
    for (int j = hmax; j < n - i; j++) h[j] = h[j + 1];
  }
  cout << (ok ? "YES\n" : "NO\n");
  return 0;
}
