import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = println(solve(new Scanner(System.in)))

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val N = sc.nextInt
    val A = Array.fill(N)(sc.nextInt)
    val As = A.zipWithIndex.map { case (a, i) => a - (i + 1) }.sorted

    println(As.mkString(","))
    if (N % 2 == 1) {
      val b = As(N / 2)
      As.map(a => (a - b).abs).sum.toString
    } else {
      val b1 = As(N / 2 - 1)
      val b2 = As(N / 2)
      val b3 = (b2 + b1) / 2
      Array(
        As.map(a => (a - b1).abs).sum,
        As.map(a => (a - b2).abs).sum,
        As.map(a => (a - b3).abs).sum
      ).min.toString
    }
  }
}
