#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  vector<int> vec;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    vec.emplace_back(a);
  }
  vec.emplace_back(vec[0]);
  vec.emplace_back(vec[1]);
  for (int j = 1; j < n + 1; j++) {
    if (abs(vec[j - 1] - vec[j + 1]) != vec[j]) {
      if (abs(vec[j - 1] + vec[j + 1]) != vec[j]) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}
