Snuke has an integer sequence A of length N.

He will freely choose an integer b. Here, he will get sad if A_i and b+i are far from each other. More specifically, the sadness of Snuke is calculated as follows:

* abs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N))



Here, abs(x) is a function that returns the absolute value of x.

Find the minimum possible sadness of Snuke.

Constraints

* 1 \leq N \leq 2 \times 10^5
* 1 \leq A_i \leq 10^9
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


N
A_1 A_2 ... A_N


Output

Print the minimum possible sadness of Snuke.

Examples

Input

5
2 2 3 5 5


Output

2


Input

9
1 2 3 4 5 6 7 8 9


Output

0


Input

6
6 5 4 3 2 1


Output

18


Input

7
1 1 1 1 2 3 4


Output

6
import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();main.solve(args);
    }

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        int N = scanner.nextInt();
        long[] list = new long[N];
        for (int i = 0; i < N; i++) {
            list[i] = scanner.nextLong();
        }


        long min =-1000000000;
        long max = 1000000000;

        long v = 0;
        while (true) {
            long mid = (min + max) /2;
            long v1 = search(mid - 1, list);
            long v2 = search(mid, list);
            long v3 = search(mid + 1, list);
            if (v1 < v2) {
                max = mid;
            } else if (v3 < v2) {
                min = mid;
            } else {
                v = mid;
                break;
            }
        }

        long ans = 0;
        for (int i = 0; i < N; i++) {
            ans += Math.abs(v - list[i]);
            v++;
        }

        System.out.println(ans);
    }

    private long search(long v, long[] list) {
        long ans = 0;
        for (int i = 0; i < list.length; i++) {
            ans += Math.abs(v - list[i]);
            v++;
        }
        return ans;
    }

    private class MyScanner {
        String[] s;int i;BufferedReader br;String reg = " ";
        MyScanner () { s = new String[0];i = 0;br = new BufferedReader(new InputStreamReader(System.in)); }
        public String next() {
            try {
                if (i < s.length) return s[i++]; String line = br.readLine();
                while (line.equals("")) {line = br.readLine();}
                s = line.split(reg, 0); i = 0;return s[i++];
            } catch (Exception e) {e.printStackTrace();}
            return null;
        }
        public int nextInt() {
            try {return Integer.parseInt(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public double nextDouble() {
            try {return Double.parseDouble(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
        public long nextLong()  {
            try {return Long.parseLong(next());} catch (Exception e) {e.printStackTrace();}
            return -1;
        }
    }
}
