#include <bits/stdc++.h>
using namespace std;
inline int Gcd(int X, int Y) { return Y ? Gcd(Y, X % Y) : X; }
inline long long Gcd(long long X, long long Y) { return Y ? Gcd(Y, X % Y) : X; }
inline int Pow(int base, long long exp, int _mod) {
  int _ans = 1;
  for (; exp; exp >>= 1, base = (long long)base * base % _mod)
    exp& 1 ? _ans = (long long)_ans * base % _mod : 0;
  return _ans;
}
inline long long Pow(long long base, long long exp, long long _mod) {
  long long _ans = 1;
  for (; exp; exp >>= 1, base = base * base % _mod)
    exp& 1 ? _ans = _ans * base % _mod : 0;
  return _ans;
}
const int INF = 0x3f3f3f3f;
int n, q;
int a[100001], b[100001];
int h[100001], nxt[200001], to[200001], tot;
inline void ins(int x, int y) {
  nxt[++tot] = h[x];
  to[tot] = y;
  h[x] = tot;
}
int main() {
  scanf("%d", &n);
  q = n;
  for (int i = 1; i <= (n); ++i) scanf("%d", a + i);
  for (int k = 1; k <= (q); ++k) {
    for (int i = 1; i <= (n - 1); ++i)
      if (abs(a[i] - a[i + 1]) >= 2) {
        puts("NO");
        return 0;
      }
    int m = 0;
    for (int i = 1; i <= (n); ++i)
      if (a[i] > a[m]) m = i;
    for (int i = m; i <= (n - 1); ++i) a[i] = a[i + 1];
    --n;
  }
  puts("YES");
  return 0;
}
