#include <bits/stdc++.h>
int main() {
  int arr[50], flag = 0;
  int t;
  scanf("%d", &t);
  for (int j = 0; j < t; j++) {
    scanf("%d", &arr[j]);
  }
  int diff[t - 1];
  for (int i = 0; i < (t - 1); i++) {
    diff[i] = abs(arr[i] - arr[i + 1]);
  }
  for (int i = 0; i < (t - 1); i++) {
    for (int j = i + 1; j < (t - 1); j++) {
      if (diff[i] == diff[j]) {
        flag++;
      } else
        break;
    }
  }
  if (flag == (t - 2))
    printf("Yes\n");
  else
    printf("No\n");
}
