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.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

public class Main {

  static BufferedReader in;
  static PrintWriter out;
  static StringTokenizer tok;

  static void solve() throws Exception {
	  
	  int n = nextInt();
	  int [] gears = readIntArray(n);
	  int [] teeth = new int[n];
	  for(int i=0;i<n;i++) {
		  teeth[i]= i;
	  }
	  int tot = n+1;
	  boolean clockwise = true;
	  int i = 0;
	  boolean found =false;
	  while(tot>=0) {
		  i = 0;
		  clockwise = true;
		  while(i < gears.length) {
			  if(clockwise) {
				  gears[i]++;
				  gears[i] = gears[i]%n;
				  clockwise = false;
			  } else {
				  gears[i]--;
				  if(gears[i] < 0) {
					  gears[i] = gears[i] +n;
				  }
				  clockwise = true;
			  }
			  i++;
		  }
		  tot--;
		  if(gears[0] ==0) {
			  found = checkorder(gears);
			  break;
		  }

	  }
	  
	  if(found)
		  System.out.println("Yes");
	  else
		  System.out.println("No");
	
  }
  
  static boolean checkorder (int gears[]) {
	  for(int i = 0 ; i < gears.length; i++) {
		  if(gears[i] != i)
			  return false;
	  }
	  return true;
  }
  
  
  static int remove(String s) {
	  if(s.length() ==0)
		  return 0;
	  boolean found = false;
	  int index = 0;
	  for(int i = 0 ; i < s.length()-1 ; i++) {
		  if(s.charAt(i) =='0' && s.charAt(i+1) =='1') {
			  found = true;
		  }
		  if(s.charAt(i) =='1' && s.charAt(i+1) =='0') {
			  found = true;
		  }
		  if(found) {
			  index = i;
			  break;
		  }
	  }
	  if(!found)
		  return s.length();
	  
	  if(found && s.length() == 2)
		  return 0;
	  return remove(s.substring(0, index)+s.substring(index+2, s.length()));
	  
  }
  
  static void taste(int t[], int c[], int i, int j) {
	  
  }
  
  static String findDist(int r1, int c1, int n, int m, String []cave, int r2, int c2, String [][] mem) {
	  
	  if(r1 >=n || c1>=m || r1 <0 || c1 <0)
		  return "";
	  
	  if(cave[n].charAt(m) == 'X') 
		  return "";
	  
	  String value = "";
	  
	  if(r1 == r2 && c1 == c2) {
		  value = "YES";
		  return value;

	  }
	  
	  if(cave[n].charAt(m) == '.') 
		  return ".";

	  
	  String value1  = findDist(r1+1, c1, n,m, cave, r2, c2, mem);
	  String value2  = findDist(r1, c1+1, n,m, cave, r2, c2, mem);
	  String value3  = findDist(r1-1, c1, n,m, cave, r2, c2, mem);
	  String value4  = findDist(r1, c1-1, n,m, cave, r2, c2, mem);
	  
	  

	  return value;
  }

  public static void main(String args[]) {
    try {
      in = new BufferedReader(new InputStreamReader(System.in));
      out = new PrintWriter(new OutputStreamWriter(System.out));
      solve();
      in.close();
      out.close();
    } catch (Throwable e) {
      e.printStackTrace();
      System.exit(1);
    }
  }

  static int nextInt() throws IOException {
    return Integer.parseInt(next());
  }

  static int[] nextIntArray(int len, int start) throws IOException {
    int[] a = new int[len];
    for (int i = start; i < len; i++)
      a[i] = nextInt();
    return a;
  }

  static long nextLong() throws IOException {
    return Long.parseLong(next());
  }

  static long[] nextLongArray(int len, int start) throws IOException {
    long[] a = new long[len];
    for (int i = start; i < len; i++)
      a[i] = nextLong();
    return a;
  }

  static double nextDouble() throws IOException {
    return Double.parseDouble(next());
  }

  static double[] nextDoubleArray(int len, int start) throws IOException {
    double[] a = new double[len];
    for (int i = start; i < len; i++)
      a[i] = nextDouble();
    return a;
  }

  static BigInteger nextBigInteger() throws IOException {
    return new BigInteger(next());
  }

  static String next() throws IOException {
    while (tok == null || !tok.hasMoreTokens()) {
      tok = new StringTokenizer(in.readLine());
    }
    return tok.nextToken();
  }

  static String nextLine() throws IOException {
    tok = new StringTokenizer("");
    return in.readLine();
  }

  static void shuffleArray(long[] array) {
    Random random = new Random();
    for (int i = array.length - 1; i > 0; i--) {
      int index = random.nextInt(i + 1);
      long temp = array[index];
      array[index] = array[i];
      array[i] = temp;
    }
  }

  static boolean hasNext() throws IOException {
    while (tok == null || !tok.hasMoreTokens()) {
      String s = in.readLine();
      if (s == null) {
        return false;
      }
      tok = new StringTokenizer(s);
    }
    return true;
  }
  
  public static int[] readIntArray(int size) throws IOException {
      int[] result = new int[size];
      for (int i = 0; i < size; i++) {
          result[i] = nextInt();
      }
      return result;
  }

}