import scala.io.StdIn.readInt

object Main {

  def insertionSort(a:Array[Int],n:Int,g:Int):Int = {
    var cnt = 0
    for(i <- g until n) {
      val v = a(i)
      var j = i-g
      while( j>=0 && a(j) > v ) {
        a(j+g) = a(j)
        j = j-g
        cnt += 1
      }
      a(j+g) = v
    }
    cnt
  }

  def getG(g:List[Int],x:Double,n:Double):List[Int] = {
    val y = x*2.25+1
    if(y > n) g
    else
      getG(Math.ceil(y).toInt::g,y,n)
  }

  def main(args:Array[String]) = {
    val n = readInt
    val a = (for(i <- 0 until n) yield readInt).toArray
    val g = getG(List(),0,n.toDouble)
    val m = g.length
    var ct = 0

    for(i <- g) {
      ct += insertionSort(a,n,i)
    }
    println(m)
    println(g.mkString(" "))
    println(ct)
    println(a.mkString("\n"))
  }
}