#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n;
int a[100000], b[100000], c[100000], top;
bool cmp(int a, int b) { return a > b; }
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i] = read(), b[i] = a[i];
  sort(b + 1, b + n + 1, cmp);
  int m = n;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j < m; j++)
      if (abs(a[j] - a[j + 1]) >= 2) {
        int t = abs(a[j] - a[j + 1]);
        if (a[j] > a[j + 1])
          a[j] -= t / 2, a[j + 1] += t / 2;
        else
          a[j] += t / 2, a[j + 1] -= t / 2;
      }
    int k = 0;
    for (int j = 1; j <= m; j++) {
      if (a[j] > a[k]) k = j;
    }
    c[++top] = a[k];
    for (int j = k + 1; j <= m; j++) a[j - 1] = a[j];
    m--;
  }
  for (int i = 1; i <= n; i++)
    if (b[i] != c[i]) {
      puts("NO");
      return 0;
    }
  puts("YES");
}
