#include<bits/stdc++.h>
using namespace std;

long long N, a[202020], b, A;

int main(){
  scanf("%lld", &N);
  for(int i = 0; i < N; a[i] -= i, ++i)scanf("%lld", a + i);
  sort(a, a + N);
  b = a[N / 2];
  for(int i = 0; i < N; ++i)A += abs(a[i] - b);
  cout << A << endl;
}
