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.util.*;
    import java.io.*;
    public class Main {
        
        static class N{
            int a,b;
            public String toString(){
                return a+" "+b;
            }
        }
        static boolean isp(long g){
            if(g<=3) return true;
            for(int i=2;i<=(int)Math.sqrt(g);i++){
                if(g%i==0) return false;
            }
            return true;
        }
        static long ge(int arr[], long l, long r, int n){
            while(true){
                long m = (l+r)/2;
                long val = getans(arr, m, n);
                long left = getans(arr, m-1, n);
                long right = getans(arr, m+1, n);
                if(left>=val && right>=val) return val;
                if(right>val) r = m-1;
                else l=m+1;
            }
        }
        /*static int  getp(int l, int r, long a, long b){
            while(true){
            int m  =(l+r)/2;
            System.out.println(m);
            long val = m*(a-m)*(b-m);
            long left = ((m-1)*(a-m+1)*(b-m+1));
            long right = ((m+1)*(a-m-1)*(b-m-1));
            if(val>=left && val>= right) return m;
            if(val > right) {
                r=m-1;
                continue;
            }
            l =m+1;
            }
        }*/
        static long getans(int arr[] , long b, int n){
            long ans =0;
            for(int i=0;i<n;i++){
                ans+=Math.abs(arr[i]-(b+i+1));
            }
            return ans;
        }
        public static void main(String args[]) throws Exception{
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
            int tc = 1;//Integer.valueOf(br.readLine());
            for(int i=0;i<tc;i++){
                int n  = Integer.valueOf(br.readLine());
                int arr[] = new int[n];
                String gf[] = br.readLine().split(" ");
                for(int ii=0;ii<n;ii++) arr[ii] = Integer.valueOf(gf[ii]);
                System.out.println(ge(arr,Integer.MIN_VALUE, Integer.MAX_VALUE, n));
                long mina =Integer.MAX_VALUE;
                /*for(int j=-1222;j<=124124;j++) {
                    mina = Math.min(mina,getans(arr,j,n));
                }
                System.out.println(mina+" mina");*/
                //bw.write(ans+"\n");
            }
            bw.flush();
        }
    }
     