$cnt = 0
$g = []

def insertionSort(a, n, g)
	g.upto(n-1) 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
end

def shellSort(a, n)
	h = 1
	$g.push(h)
	
	loop do
		h = 3*h + 1
		break if h > n
		$g.push(h)
	end

	1.upto($g.size) do |i|
		insertionSort(a, n, $g[-i])
	end
end

n = gets.to_i
a = []
n.times do |i|
	a[i] = gets.to_i
end

shellSort(a, n)

puts $g.size
puts $g.reverse.join(" ")
puts $cnt
puts a.join("\n")