def insersionSort(a, n, g)
  cnt = 0
  for i in g..n-1
    v = a[i]
    j = i - g
    while j >= 0 && a[j] > v
      a[j+g] = a[j]
      j = j - g
      cnt += 1
    end
    a[j+g] = v
  end
  return cnt
end

def shellSort(a, n)
  cnt = 0
  g = []
  g[0] = 1
  m = 0
  while 3*g[m]+1 < n
    g[m+1] = 3*g[m]+1
    m += 1
  end
  g = g.reverse
  puts m + 1
  puts g.join(" ")
  for i in 0..m
    cnt += insersionSort(a, n, g[i])
  end
  puts cnt
  a.each{|key|
    puts key
  }
end

n = gets.to_i
a = []
0.upto(n-1){|i|
  a[i]= gets.to_i
}
shellSort(a, n)