#import <stdio.h>
#define ABS(a) ((a)>0?(a):(-(a)))
int main(){
    long n;
    scanf("%ld",&n);
    long A[200003] = {0};
    for (long i=1;i<=n;i++){
        long a;
        scanf("%ld",&a);
        A[i] = a-i;
    }
    long k=(n+1)/2;
    long s=0;
    for (long i=1;i<=n;i++){
        s += ABS(A[i]-A[k]);
    }
    printf("%ld",s);
}
