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

def shell_sort(ary,num)
  cnt = 0
  m = (num+1)/3
  g = Array.new(m)
  for i in 0..m-1
    g[i] = 3*i + 1
  end
  g.reverse!
  for i in 0..m-1
    cnt += insertion_sort(ary,num,g[i])
  end
  puts m
  puts g.join(" ")
  puts cnt
end

n = gets.to_i
a = []
n.times do
  a << gets.to_i
end
shell_sort(a,n)
puts a