Andrewid the Android is a galaxy-famous detective. He is now investigating a case of frauds who make fake copies of the famous Stolp's gears, puzzles that are as famous as the Rubik's cube once was.

Its most important components are a button and a line of n similar gears. Each gear has n teeth containing all numbers from 0 to n - 1 in the counter-clockwise order. When you push a button, the first gear rotates clockwise, then the second gear rotates counter-clockwise, the the third gear rotates clockwise an so on.

Besides, each gear has exactly one active tooth. When a gear turns, a new active tooth is the one following after the current active tooth according to the direction of the rotation. For example, if n = 5, and the active tooth is the one containing number 0, then clockwise rotation makes the tooth with number 1 active, or the counter-clockwise rotating makes the tooth number 4 active.

Andrewid remembers that the real puzzle has the following property: you can push the button multiple times in such a way that in the end the numbers on the active teeth of the gears from first to last form sequence 0, 1, 2, ..., n - 1. Write a program that determines whether the given puzzle is real or fake.

Input

The first line contains integer n (1 ≤ n ≤ 1000) — the number of gears.

The second line contains n digits a1, a2, ..., an (0 ≤ ai ≤ n - 1) — the sequence of active teeth: the active tooth of the i-th gear contains number ai.

Output

In a single line print "Yes" (without the quotes), if the given Stolp's gears puzzle is real, and "No" (without the quotes) otherwise.

Examples

Input

3
1 0 0


Output

Yes


Input

5
4 2 1 4 3


Output

Yes


Input

4
0 2 3 1


Output

No

Note

In the first sample test when you push the button for the first time, the sequence of active teeth will be 2 2 1, when you push it for the second time, you get 0 1 2.
#include <bits/stdc++.h>
using namespace std;
const int inf = 0x7FFFFFFF;
struct point_int {
  int x, y;
  point_int() {}
  point_int(int a, int b) { x = a, y = b; }
};
struct point_double {
  double x, y;
  point_double() {}
  point_double(double a, double b) { x = a, y = b; }
};
struct Node {
  int v, w;
  Node() {}
  bool operator<(const Node &a) const { return w > a.w; }
  Node(int _v, int _w) { v = _v, w = _w; }
};
namespace my {
template <class T>
T gcd(T a, T b) {
  return b == 0 ? a : gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
T big_mod(T n, T p, T m) {
  if (p == 0) return (T)1;
  T x = big_mod(n, p / 2, m);
  x = (x * x) % m;
  if (p & 1) x = (x * n) % m;
  return x;
}
template <class T>
T multiplication(T n, T p, T m) {
  if (p == 0) return (T)0;
  T x = multiplication(n, p / 2, m);
  x = (x + x) % m;
  if (p & 1) x = (x + n) % m;
  return x;
}
template <class T>
T my_pow(T n, T p) {
  if (p == 0) return 1;
  T x = my_pow(n, p / 2);
  x = (x * x);
  if (p & 1) x = (x * n);
  return x;
}
template <class T>
double getdist(T a, T b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
template <class T>
T extract(string s, T ret) {
  stringstream ss(s);
  ss >> ret;
  return ret;
}
template <class T>
string tostring(T n) {
  stringstream ss;
  ss << n;
  return ss.str();
}
template <class T>
inline T Mod(T n, T m) {
  return (n % m + m) % m;
}
template <class T>
T MIN3(T a, T b, T c) {
  return min(a, min(b, c));
}
template <class T>
T MAX3(T a, T b, T c) {
  return max(a, max(b, c));
}
template <class T>
void print_vector(T &v) {
  int sz = v.size();
  if (sz) cout << v[0];
  for (int i = 1; i < sz; i++) cout << ' ' << v[i];
  cout << endl;
}
bool isVowel(char ch) {
  ch = toupper(ch);
  if (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E')
    return true;
  return false;
}
bool isConsonant(char ch) {
  if (isalpha(ch) && !isVowel(ch)) return true;
  return false;
}
}  // namespace my
int read_int() {
  int n;
  scanf("%d", &n);
  return n;
}
int read_LLD() {
  long long int n;
  scanf("%lld", &n);
  return n;
}
inline int buffer_input() {
  char inp[1000];
  scanf("%s", inp);
  return atoi(inp);
}
int puzzle[1005];
int newMove[1005];
int N;
bool isOk() {
  for (int i = 0; i < N; i++) {
    if (i != newMove[i]) return false;
  }
  return true;
}
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> puzzle[i];
    newMove[i] = puzzle[i];
  }
  for (int i = 0; i < 1000; i++) {
    for (int j = 0; j < N; j++) {
      if (j % 2)
        newMove[j] = my::Mod(newMove[j] - 1, N);
      else
        newMove[j] = my::Mod(newMove[j] + 1, N);
    }
    if (isOk()) {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
  return 0;
}
