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