def insertionSort(a, n, g)
	g.upto(n-1) do |i|
		v = a[i]
		j = i-g
		
		while j >= 0 && v < a[j]
			a[j+g] = a[j]
			j -= g
			
			$cnt += 1
		end
		
		a[j+g] = v
	end
	
	return a
end

def shellSort(a, n)
	$cnt = 0
	$g = [1]
	
	h = 1
	loop do
		h = h*3 + 1
		break if h > n
		$g.unshift(h)
	end

	$m = $g.size

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

# 標準入力
N = gets.to_i
A = []
N.times do |i|
	A[i] = gets.to_i
end

# 標準出力
a = shellSort(A, N)

puts $m
puts $g.join(" ")
puts $cnt
puts A

