object Main extends App {
  def abs(N: Int): Int = if (N >= 0) N else -N

  val N = io.StdIn.readInt()
  val A = io.StdIn.readLine().split(" ").map(_.toInt)
  var i = 0
  while (i < N) {
    A(i) -= i + 1
    i += 1
  }
  val B = A.sorted
  val mid = B(N / 2)
  val sad = B.map(elem => abs(elem - mid)).sum
  println(sad)
}
