def insertion_sort(a, n, g)
  cnt = 0
  g.upto(n-1).each {|i|
    v = a[i]
    j = i - g
    while j >= 0 && a[j] > v do
      a[j+g] = a[j]
      j = j -g
      cnt += 1
    end
    a[j+g] = v
  }
  cnt
end

def shell_sort(a, n)
  cnt = 0
  g = []
  h = 1
  loop do
    g << h
    h = h * 3 + 1
    break if n < h
  end
  m = g.size
  g.reverse!
  0.upto(m-1).each {|i|
    cnt += insertion_sort(a, n, g[i])
  }
  return m, g, cnt
end

n = gets.to_i
a = 1.upto(n).map {gets.to_i}
m, g, cnt = shell_sort(a, n)

puts m
puts g.join(" ")
puts cnt
a.each {|x| puts x}