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

int main()
{
  int n;
  cin >> n;
  vector<int64_t> a(n);

  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] -= i + 1;
  }
  sort(begin(a), end(a));

  int64_t ans(0);
  for (int i = 0; i < n; i++) {
    int64_t t = a[i] - a[n / 2];
    ans += t < 0 ? -t : t;
  }
  cout << ans << endl;
}
