#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
int n, l, x;
int main() {
  n = read(), l = read();
  while (--n) {
    x = read();
    if ((x - l) * (l - x) != -1 && x != l) return puts("NO"), 0;
    l = x;
  }
  puts("YES");
  return 0;
}
