MODE = "stdio"
#require 'matrix'
#include Math
line = Array.new

if(defined? MODE)
  line = STDIN.read.split("\n")
else
  tmp = '12
  11
  1
  4
  5
  5
  7
  8
  3
  2
  8
  3
  2'.split("\n")
  tmp.each{|s|
    line << s.strip
  }
end

n = line[0].to_i
arr=[]
(1..n).each do |num|
  arr << line[num].to_i
end

def insertion_sort(a, n, g)
  cnt = 0
  (g..n-1).each do |i|
    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
 
 
g = [1]
cnt = 0
while (i = 2 * g[0] + 1) < n do
 g.unshift(i)
end

g.each do |i|
 cnt += insertion_sort(arr, n, i)
end
 
puts g.size
puts g.join(" ")
puts cnt
puts arr