#include<bits/stdc++.h>
using namespace std;
 
int main(){
	int n;
	cin>>n;
	int a[200000];
	for (int i = 0; i < n; ++i){
		cin>>a[i];
		a[i]-=(i+1);
	}

	sort(a,a+n);
	int x=a[n/2];
	long sum=0;
	for (int i = 0; i < n; ++i){
		sum+=abs(a[i]-x);
	}

	cout<<sum<<endl;

}
