import scala.io.StdIn

object Main extends App {

  val n = StdIn.readLine().toInt
  val a = StdIn.readLine().split(" ").map(_.toLong)
  val aind = a.zipWithIndex
  
  //val r = aind.map( ai => scala.math.abs(ai._1 - (ai._2 + 1)))
  val r = aind.map( ai => ai._1 - (ai._2 + 1))
  val ind = r.distinct
  //println(ind.mkString(" "))
  
  val mina = for(d <- ind) yield aind.foldLeft(0L)( (acc ,ai) => acc + scala.math.abs(ai._1 - (d + ai._2 + 1)))

  //println(mina.toList.mkString(" "))

  println(mina.min)

}
