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.*;
import java.util.*;

public class Main {
    private final static InputReader ir = new InputReader(System.in);
    private final static OutputWriter ow = new OutputWriter(System.out);
    private final static int INF = Integer.MAX_VALUE;
    private final static int NINF = Integer.MIN_VALUE;
    private final static double PI = Math.PI;

    public static void main(String[] args) throws IOException {
        try {
            task();
        } finally {
            boolean exc = false;
            try {
                ir.close();
            } catch (IOException e) {
                e.printStackTrace();
                exc = true;
            }
            try {
                ow.close();
            } catch (IOException e) {
                e.printStackTrace();
                exc = true;
            }
            if (exc) System.exit(1);
        }
    }

    private static void task() throws IOException {
        int n = ir.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; ++i) {
            a[i] = ir.nextInt();
        }
        int r = n - a[0];
        for (int i = 0; i < n; ++i) {
            if (i % 2 == 0) {
                a[i] += r;
            } else {
                a[i] += n - r;
            }
            a[i] %= n;
            if (a[i] != i) {
                ow.print("NO");
                return;
            }
        }
        ow.print("YES");
    }

    private static int max(int... objects) {
        if (objects.length == 0)
            throw new IllegalArgumentException("objects.length == 0");
        int max = objects[0];
        for (int i = 1; i < objects.length; ++i) {
            if (max < objects[i])
                max = objects[i];
        }
        return max;
    }

    private static int min(int... objects) {
        if (objects.length == 0)
            throw new IllegalArgumentException("objects.length == 0");
        int min = objects[0];
        for (int i = 1; i < objects.length; ++i) {
            if (min > objects[i])
                min = objects[i];
        }
        return min;
    }

    private static long pow(int x, int n) {
        if (x == 0) return 0;
        if (x == 1 || n == 0) return 1;
        if (x == 2) return x << (n - 1);
        if (n == 1) return x;
        long t = pow(x, n / 2);
        if (n % 2 == 0) return t * t;
        else return t * t * x;
    }

    private static double pow(double x, int n) {
        if (x == 0.0) return 0;
        if (x == 1.0 || n == 0) return 1;
        if (n == 1) return x;
        double t = pow(x, n / 2);
        if (n % 2 == 0) return t * t;
        else return t * t * x;
    }

    private static int abs(int a) {
        return (a >= 0 ? a : -a);
    }
}

class Pair<T, P> {
    T f;
    P s;
    Pair(T f, P s) {
        this.f = f;
        this.s = s;
    }
}

class Triple<T, P, V> {
    T f;
    P s;
    V t;
    Triple(T f, P s, V t) {
        this.f = f;
        this.s = s;
        this.t = t;
    }
}

class InputReader implements AutoCloseable {
    private final InputStream in;
    private int capacity;
    private byte[] buffer;
    private int len = 0;
    private int cur = 0;

    public InputReader(InputStream stream) {
        this(stream, 100_000);
    }

    public InputReader(InputStream stream, int capacity) {
        this.in = stream;
        this.capacity = capacity;
        buffer = new byte[capacity];
    }

    private boolean update() {
        if (cur >= len) {
            try {
                cur = 0;
                len = in.read(buffer, 0, capacity);
                if (len <= 0)
                    return false;
            } catch (IOException e) {
                throw new InputMismatchException();
            }
        }
        return true;
    }

    private int read() {
        if (update())
            return buffer[cur++];
        else return -1;
    }

    public boolean isEmpty() {
        return !update();
    }

    private boolean isSpace(int c) {
        return c == '\n' || c == '\t' || c == '\r' || c == ' ';
    }

    private boolean isEscape(int c) {
        return c == '\n' || c == '\t' || c == '\r' || c == -1;
    }

    private int readSkipSpace() {
        int c;
        do {
            c = read();
        } while (isSpace(c));
        return c;
    }

    public int nextInt() {
        int c = readSkipSpace();
        if (c < 0)
            throw new InputMismatchException();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c == -1) break;
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res = res * 10 + c - '0';
            if (res < 0)
                throw new InputMismatchException();
            c = read();
        } while (!isSpace(c));
        res *= sgn;
        return res;
    }

    public int[] getAllInts() {
        List<Integer> list = new LinkedList<>();
        while (true) {
            try {
                int t = nextInt();
                list.add(t);
            } catch (InputMismatchException e) {
                break;
            }
        }
        int[] a = new int[list.size()];
        Iterator<Integer> it = list.iterator();
        for (int i = 0; it.hasNext(); ++i)
            a[i] = it.next();
        return a;
    }

    public int[] getIntArray1D(int n) {
        int[] array = new int[n];
        for (int i = 0; i < n; ++i) {
            array[i] = nextInt();
        }
        return array;
    }

    public int[][] getIntArray2D(int n, int m) {
        int[][] array = new int[n][m];
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < m; ++j)
                array[i][j] = nextInt();
        }
        return array;
    }

    public long nextLong() {
        int c = readSkipSpace();
        if (c < 0)
            throw new InputMismatchException();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c == -1) break;
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res = res * 10 + c - '0';
            if (res < 0)
                throw new InputMismatchException();
            c = read();
        } while (!isSpace(c));
        res *= sgn;
        return res;
    }

    public long[] getAllLongs() {
        List<Long> list = new LinkedList<>();
        while (true) {
            try {
                long t = nextLong();
                list.add(t);
            } catch (InputMismatchException e) {
                break;
            }
        }
        long[] a = new long[list.size()];
        Iterator<Long> it = list.iterator();
        for (int i = 0; it.hasNext(); ++i)
            a[i] = it.next();
        return a;
    }

    public long[] getLongArray1D(int n) {
        long[] array = new long[n];
        for (int i = 0; i < n; ++i) {
            array[i] = nextLong();
        }
        return array;
    }

    public long[][] getLongArray2D(int n, int m) {
        long[][] array = new long[n][m];
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < m; ++j)
                array[i][j] = nextLong();
        }
        return array;
    }

    public int nextChar() {
        int c = readSkipSpace();
        if (c < 0)
            throw new InputMismatchException();
        return c;
    }

    public String nextLine(int initialCapacity) {
        StringBuilder res = new StringBuilder(initialCapacity);
        int c = readSkipSpace();
        do {
            res.append((char) (c));
            c = read();
        } while (!isEscape(c));
        return res.toString();
    }

    @Override
    public void close() throws IOException {
        in.close();
    }
}

class OutputWriter implements Flushable, AutoCloseable {
    private byte[] buf;
    private final int capacity;
    private int count;
    private OutputStream out;

    public OutputWriter(OutputStream stream) {
        this(stream, 10_000);
    }

    public OutputWriter(OutputStream stream, int capacity) {
        if (capacity < 0)
            throw new IllegalArgumentException("capacity < 0");
        out = stream;
        this.capacity = capacity;
        if (capacity != 0) {
            buf = new byte[capacity];
        }
    }

    public void write(int b) throws IOException {
        if (capacity != 0) {
            if (count >= capacity)
                flushBuffer();
            buf[count++] = (byte) b;
        } else {
            out.write(b);
        }
    }

    public void write(byte[] bytes, int off, int len) throws IOException {
        if (capacity != 0) {
            if (len >= capacity) {
                flushBuffer();
                out.write(bytes, off, len);
                return;
            }
            if (len > capacity - count)
                flushBuffer();
            System.arraycopy(bytes, off, buf, count, len);
            count += len;
        } else out.write(bytes, off, len);
    }

    public void write(byte[] bytes) throws IOException {
        write(bytes, 0, bytes.length);
    }

    public void println() throws IOException {
        print("\n");
    }

    public void print(Object object) throws IOException {
        write(String.valueOf(object).getBytes());
    }

    public void println(Object object) throws IOException {
        print(object);
        println();
    }

    public void print(int... ints) throws IOException {
        print(" ", ints);
    }

    public void println(int... ints) throws IOException {
        print(ints);
        println();
    }

    public void println(String separator, int... ints) throws IOException {
        print(separator, ints);
        println();
    }

    public void print(String separator, int... ints) throws IOException {
        if (ints.length == 0) throw new IllegalArgumentException("ints.length == 0");
        for (int i = 0; i < ints.length; ++i) {
            if (i != 0) print(separator);
            print(ints[i]);
        }
    }

    private void flushBuffer() throws IOException {
        if (count > 0) {
            out.write(buf, 0, count);
            count = 0;
        }
    }

    @Override
    public void flush() throws IOException {
        flushBuffer();
        out.flush();
    }

    @Override
    public void close() throws IOException {
        flush();
        out.close();
    }
}

