def insertionsort(a,n,g)
  cnt = 0
  for i in g...n
    v = a[i]
    j = i-g
    while j >= 0 && a[j] > v
      a[j+g] = a[j]
      j -= g
      cnt += 1
    end
    a[j+g] = v
  end
  cnt
end

def shellsort(a,n)
  cnt = 0
  g = Array.new
  m = h = 1
  g.push(h)
  while h * 3 + 1 < n
    h = h * 3 + 1
    g.unshift(h)
    m += 1
  end
  puts m
  for i in 0...m
    print " " unless i == 0
    print g[i]
  end
  print "\n"
  for i in 0...m
    cnt += insertionsort(a,n,g[i])
  end
  puts cnt
end

n = gets.to_i
a = Array.new(n)
for i in 0...n
  a[i] = gets.to_i
end
shellsort(a,n)
for i in 0...n
  puts a[i]
end