def PrintArr(a)
	a.length.times { |i|
		print " " unless i == 0
		print a[i]
	}
	puts
end

def InsertionSort(a, g)
	for i in g...a.length
		v = a[i]
		j = i - g
		while j >= 0 and v < a[j]
			a[j+g] = a[j]
			j = j - g
			$cnt += 1
		end
		a[j+g] = v
	end
end

a = Array.new
gets.to_i.times { a << gets.to_i }

$cnt = 0
g = Array.new
m = 0

while true
	n = (m+1)**2
	break if n > a.length
	g << n
	m = g.length
end

g.sort!.reverse!

for i in 0...m
	InsertionSort(a, g[i])
end

puts m
PrintArr(g)
puts $cnt
a.each {|n| puts n }