G = []
cnt = 0

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

def shellSort(n, A):
  m = 1
  while m <= n / 9:
    m = m * 3 + 1
  while 0 < m:
    global G
    G.append(m)
    insertionSort(A, n, m)
    m = int(m / 3)

A = []
n = int(input())

for i in range(n):
  A.append(int(input()))

shellSort(n, A)

print(len(G))
print(*G)
print(cnt)

for i in range(n):
  print(A[i]) G = [] G [] cnt = 0 cnt 0 def insertionSort(A, n, g):
  for i in range(g, n):
    v = A[i]
    j = i - g
    while j >= 0 and A[j] > v:
      global cnt
      cnt += 1
      A[j+g] = A[j]
      j -= g
    A[j+g] = v insertionSort for i in range(g, n):
    v = A[i]
    j = i - g
    while j >= 0 and A[j] > v:
      global cnt
      cnt += 1
      A[j+g] = A[j]
      j -= g
    A[j+g] = v i range(g, n) range g n v = A[i] v A[i] A i j = i - g j i - g i g while j >= 0 and A[j] > v:
      global cnt
      cnt += 1
      A[j+g] = A[j]
      j -= g
     j >= 0 and A[j] > v j >= 0 j 0 A[j] > v A[j] A j v global cnt cnt += 1 cnt 1 A[j+g] = A[j] A[j+g] A j+g j g A[j] A j j -= g j g A[j+g] = v A[j+g] A j+g j g v A A n n g g def shellSort(n, A):
  m = 1
  while m <= n / 9:
    m = m * 3 + 1
  while 0 < m:
    global G
    G.append(m)
    insertionSort(A, n, m)
    m = int(m / 3) shellSort m = 1 m 1 while m <= n / 9:
    m = m * 3 + 1
   m <= n / 9 m n / 9 n 9 m = m * 3 + 1 m m * 3 + 1 m * 3 m 3 1 while 0 < m:
    global G
    G.append(m)
    insertionSort(A, n, m)
    m = int(m / 3) 0 < m 0 m global G G.append(m) G.append G append m insertionSort(A, n, m) insertionSort A n m m = int(m / 3) m int(m / 3) int m / 3 m 3 n n A A A = [] A [] n = int(input()) n int(input()) int input() input for i in range(n):
  A.append(int(input())) i range(n) range n A.append(int(input())) A.append A append int(input()) int input() input shellSort(n, A) shellSort n A print(len(G)) print len(G) len G print(*G) print *G G print(cnt) print cnt for i in range(n):
  print(A[i]) i range(n) range n print(A[i]) print A[i] A i def insertionSort(A, n, g):
  for i in range(g, n):
    v = A[i]
    j = i - g
    while j >= 0 and A[j] > v:
      global cnt
      cnt += 1
      A[j+g] = A[j]
      j -= g
    A[j+g] = v def insertionSort(A, n, g):
  for i in range(g, n):
    v = A[i]
    j = i - g
    while j >= 0 and A[j] > v:
      global cnt
      cnt += 1
      A[j+g] = A[j]
      j -= g
    A[j+g] = v insertionSort A = [] [] A G = [] [] G cnt = 0 0 cnt n = int(input()) int(input()) n def shellSort(n, A):
  m = 1
  while m <= n / 9:
    m = m * 3 + 1
  while 0 < m:
    global G
    G.append(m)
    insertionSort(A, n, m)
    m = int(m / 3) def shellSort(n, A):
  m = 1
  while m <= n / 9:
    m = m * 3 + 1
  while 0 < m:
    global G
    G.append(m)
    insertionSort(A, n, m)
    m = int(m / 3) shellSort
G = []
cnt = 0

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

def shellSort(n, A):
  m = 1
  while m <= n / 9:
    m = m * 3 + 1
  while 0 < m:
    global G
    G.append(m)
    insertionSort(A, n, m)
    m = int(m / 3)

A = []
n = int(input())

for i in range(n):
  A.append(int(input()))

shellSort(n, A)

print(len(G))
print(*G)
print(cnt)

for i in range(n):
  print(A[i])
