n=gets.chomp.to_i
ary=Array.new
for i in 0..n-1
	ary=ary.push(gets.chomp.to_i)
end


def insertion(ary,n,g)
	@count=0
	for i in g..n-1
		v=ary[i]
		j=i-g
		while j>=0 && ary[j]>v
			ary[j+g]=ary[j]
			j-=g
		end
		ary[j+g]=v
			@count+=1
	end
end



g=n/2.to_i
puts g
k=Array.new
while g>=1 
	insertion(ary,n,g)
	k=k.push(g)
	g=g/2.to_i
end
puts(k.join(" "))
puts @count

puts(ary)