#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int x = a[1] - a[0];
  int p = 0;
  for (int i = 0; i < n; i++) {
    p = max(p, a[i] - a[i - 1]);
  }
  if (x == p) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
}
