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

def shell_sort(a,n)
  cnt = 0
  m = n
  g = Array.new(n)
  for i in 0..n - 1
    g[i] = n - i - 1
  end
  for i in 0..m - 1
    insertion_sort(a,n,g[i],cnt)
  end
  a.map! {|x| x.to_i}
  puts m
  puts g.join(" ")
  puts a
end
cnt = 0
datas = $stdin.read.split("\n")
n = datas[0].to_i
datas = datas.drop(1)
datas.map! do |x|
  x.to_i
end
shell_sort(datas,n)
