#include <bits/stdc++.h>
using namespace std;
int a[11];
int b[11];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) {
    int maximum = 0;
    int cord = 0;
    for (int j = 0; j < n - i; j++)
      if (a[j] > maximum) {
        maximum = a[j];
        cord = j;
      }
    int cur = 0;
    for (int j = 1; j < n - i; j++) {
      if (abs(a[j] - a[j - 1]) >= 2) {
        printf("NO\n");
        return 0;
      }
    }
    for (int j = 0; j < n - i; j++)
      if (j != cord) {
        a[cur] = a[j];
        cur++;
      }
    b[i] = maximum;
  }
  for (int j = 1; j < n; j++) {
    if (abs(b[j] - b[j - 1]) >= 2) {
      printf("NO\n");
      return 0;
    }
  }
  printf("YES\n");
  return 0;
}
