#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int main() {
  ll n;
  cin >> n;
  ll a[110000];
  for (ll i = ll(1); i < ll(n + 1); i++) cin >> a[i];
  a[0] = a[n];
  a[n + 1] = a[0];
  bool p = true;
  for (ll i = ll(0); i < ll(n - 1); i++) {
    if (a[i + 1] == abs(a[i + 2] - a[i]) || a[i + 1] == abs(a[i + 2] + a[i]))
      continue;
    else {
      p = false;
      break;
    }
  }
  if (p)
    cout << "Yes";
  else
    cout << "No";
}
