# -*- coding: utf-8 -*-
from sys import stdin

def insertion_sort2(A, g):
  global cnt

  for i in range(g, len(A)):
    v = A[i]
    j = i - g
    while j >= 0 and A[j] > v:
      A[j + g] = A[j]
      j = j - g
      cnt += 1
    A[j + g] = v


def shell_sort2(A, b):
  global cnt
  cnt = 0
  G = [1]
  for i in range(100):
    val = 1 + b * G[-1]
    if len(A) < val:
      break
    G.append(val)
  m = len(G)
  G.reverse()
  print(m)
  print(' '.join(map(str, G)))
  for i in range(m):
    insertion_sort2(A, G[i])
  print(cnt)
  for e in A:print(e)


n = int(stdin.readline().rstrip())
A = [int(stdin.readline().rstrip()) for i in range(n)]
shell_sort2(A, 3)
 from sys import stdin def insertion_sort2(A, g):
  global cnt

  for i in range(g, len(A)):
    v = A[i]
    j = i - g
    while j >= 0 and A[j] > v:
      A[j + g] = A[j]
      j = j - g
      cnt += 1
    A[j + g] = v insertion_sort2 global cnt for i in range(g, len(A)):
    v = A[i]
    j = i - g
    while j >= 0 and A[j] > v:
      A[j + g] = A[j]
      j = j - g
      cnt += 1
    A[j + g] = v i range(g, len(A)) range g len(A) len A v = A[i] v A[i] A i j = i - g j i - g i g while j >= 0 and A[j] > v:
      A[j + g] = A[j]
      j = j - g
      cnt += 1
     j >= 0 and A[j] > v j >= 0 j 0 A[j] > v A[j] A j v A[j + g] = A[j] A[j + g] A j + g j g A[j] A j j = j - g j j - g j g cnt += 1 cnt 1 A[j + g] = v A[j + g] A j + g j g v A A g g def shell_sort2(A, b):
  global cnt
  cnt = 0
  G = [1]
  for i in range(100):
    val = 1 + b * G[-1]
    if len(A) < val:
      break
    G.append(val)
  m = len(G)
  G.reverse()
  print(m)
  print(' '.join(map(str, G)))
  for i in range(m):
    insertion_sort2(A, G[i])
  print(cnt)
  for e in A:print(e) shell_sort2 global cnt cnt = 0 cnt 0 G = [1] G [1] 1 for i in range(100):
    val = 1 + b * G[-1]
    if len(A) < val:
      break
    G.append(val)
   i range(100) range 100 val = 1 + b * G[-1] val 1 + b * G[-1] 1 b * G[-1] b G[-1] G -1 if len(A) < val:
      break
     len(A) < val len(A) len A val break G.append(val) G.append G append val m = len(G) m len(G) len G G.reverse() G.reverse G reverse print(m) print m print(' '.join(map(str, G))) print ' '.join(map(str, G)) ' '.join ' ' join map(str, G) map str G for i in range(m):
    insertion_sort2(A, G[i])
   i range(m) range m insertion_sort2(A, G[i]) insertion_sort2 A G[i] G i print(cnt) print cnt for e in A:print( e A A A b b n = int(stdin.readline().rstrip()) n int(stdin.readline().rstrip()) int stdin.readline().rstrip() stdin.readline().rstrip stdin.readline() stdin.readline stdin readline rstrip int(stdin.readline().rstrip()) for i in range(n) for i in range(n) i range(n) range n for i in range(n) int(stdin.readline().rstrip()) int stdin.readline().rstrip() stdin.readline().rstrip stdin.readline() stdin.readline stdin readline rstrip A = [int(stdin.readline().rstrip()) for i in range(n)] A [int(stdin.readline().rstrip()) for i in range(n)] shell_sort2(A, 3) shell_sort2 A 3 def insertion_sort2(A, g):
  global cnt

  for i in range(g, len(A)):
    v = A[i]
    j = i - g
    while j >= 0 and A[j] > v:
      A[j + g] = A[j]
      j = j - g
      cnt += 1
    A[j + g] = v def insertion_sort2(A, g):
  global cnt

  for i in range(g, len(A)):
    v = A[i]
    j = i - g
    while j >= 0 and A[j] > v:
      A[j + g] = A[j]
      j = j - g
      cnt += 1
    A[j + g] = v insertion_sort2 def shell_sort2(A, b):
  global cnt
  cnt = 0
  G = [1]
  for i in range(100):
    val = 1 + b * G[-1]
    if len(A) < val:
      break
    G.append(val)
  m = len(G)
  G.reverse()
  print(m)
  print(' '.join(map(str, G)))
  for i in range(m):
    insertion_sort2(A, G[i])
  print(cnt)
  for e in A:print(e) def shell_sort2(A, b):
  global cnt
  cnt = 0
  G = [1]
  for i in range(100):
    val = 1 + b * G[-1]
    if len(A) < val:
      break
    G.append(val)
  m = len(G)
  G.reverse()
  print(m)
  print(' '.join(map(str, G)))
  for i in range(m):
    insertion_sort2(A, G[i])
  print(cnt)
  for e in A:print(e) shell_sort2 A = [int(stdin.readline().rstrip()) for i in range(n)] [int(stdin.readline().rstrip()) for i in range(n)] A n = int(stdin.readline().rstrip()) int(stdin.readline().rstrip()) n
# -*- coding: utf-8 -*-
from sys import stdin

def insertion_sort2(A, g):
  global cnt

  for i in range(g, len(A)):
    v = A[i]
    j = i - g
    while j >= 0 and A[j] > v:
      A[j + g] = A[j]
      j = j - g
      cnt += 1
    A[j + g] = v


def shell_sort2(A, b):
  global cnt
  cnt = 0
  G = [1]
  for i in range(100):
    val = 1 + b * G[-1]
    if len(A) < val:
      break
    G.append(val)
  m = len(G)
  G.reverse()
  print(m)
  print(' '.join(map(str, G)))
  for i in range(m):
    insertion_sort2(A, G[i])
  print(cnt)
  for e in A:print(e)


n = int(stdin.readline().rstrip())
A = [int(stdin.readline().rstrip()) for i in range(n)]
shell_sort2(A, 3)

