#include <bits/stdc++.h>
using namespace std;
long long N;
bool hantei(long long a, long long b, long long c) {
  long long xr = 0;
  if (a >= c) {
    xr = a / c * c + a % c;
  } else {
    xr = c - a;
  }
  if (xr == b) {
    return true;
  } else {
    return false;
  }
}
int main() {
  cin >> N;
  vector<long long> a(N, 0);
  for (long long i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (long long i = 1; i < N - 1; i++) {
    if (hantei(a[i - 1], a[i + 1], a[i]) == false) {
      cout << "No" << endl;
      return 0;
    }
  }
  if (hantei(a[N - 1], a[1], a[0]) == false) {
    cout << "No" << endl;
    return 0;
  }
  if (hantei(a[N - 2], a[0], a[N - 1]) == false) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
}
