# get input
n=gets.to_i
target=[]
n.times do
  target << gets.to_i
end

# insertion sort method
def insertion_sort a, n, g
  cnt = 0
  (g..n-1).each 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
  return cnt
end

# main
g = [n]
begin
  g << (g[-1]**(1/2.0)).to_i
  cnt = insertion_sort target, n, g[-1]
end while g[-1] > 1
g.delete_at(0)

# output
puts g.length
puts g*' '
puts cnt
target.each do |i|
 puts i
end