n = gets.to_i
a = n.times.map{gets.to_i}

$cnt = 0

def insertionSort(a, n, g)
    for i in g..n-1
        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

k = 1
k_ary = []
while k <= n
    k_ary.push(k)
    k = 3*k + 1
end

k_ary.reverse!

puts k_ary.length
puts k_ary.join(" ")

for i in 0..k_ary.length-1
    insertionSort(a, n, k_ary[i])
end

puts $cnt
puts a
