def insertionSort( nums, n, g )
	cnt = 0
	for i in ( g ... nums.length )
	    v = nums[i]
	    j = i - g
	    while 0 <= j && v < nums[j]
	        nums[ j+g ] = nums[j]
	        j -= g
	        cnt += 1
	    end
	    nums[ j+g ] = v
	end
	
	return cnt
end

def shellSort( nums, n )
	cnt = 0
	g = []
	for i in ( 0 ... n )
		val = 3*i+1
		break if  n <= val
		g.push( val )
	end
	g.reverse!
	m = g.length
	puts( m )
	puts( g.join( " " ) )
	for i in ( 0 ... m )
		cnt += insertionSort( nums, n, g[i] )
	end
    puts( cnt )
end

n = gets.to_i
nums = []
for i in ( 0 ... n )
	nums.push( gets.to_i )
end

shellSort( nums, n )
nums.each { |val| puts( val ) }