def insertion_sort(A, n, g, cnt):
  for i in range(g, n):
    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
  return cnt

def shell_sort(A, n):
  cnt = 0
  G = []
  h = 1
  while h <= n:
    G.append(h)
    h = h * 3 + 1
  m = len(G)
  G = G[::-1]

  for i in range(m):
    cnt = insertion_sort(A, n, G[i], cnt)

  return m, G, cnt

data = []
for i in range(int(input())):
  data.append(int(input()))

m, G, cnt = shell_sort(data, len(data))
print(m)
print(" ".join(map(str, G)))
print(cnt)
for i in data: print(i) def insertion_sort(A, n, g, cnt):
  for i in range(g, n):
    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
  return cnt insertion_sort for i in range(g, n):
    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, 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:
      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 return cnt cnt A A n n g g cnt cnt def shell_sort(A, n):
  cnt = 0
  G = []
  h = 1
  while h <= n:
    G.append(h)
    h = h * 3 + 1
  m = len(G)
  G = G[::-1]

  for i in range(m):
    cnt = insertion_sort(A, n, G[i], cnt)

  return m, G, cnt shell_sort cnt = 0 cnt 0 G = [] G [] h = 1 h 1 while h <= n:
    G.append(h)
    h = h * 3 + 1
   h <= n h n G.append(h) G.append G append h h = h * 3 + 1 h h * 3 + 1 h * 3 h 3 1 m = len(G) m len(G) len G G = G[::-1] G G[::-1] G ::-1 -1 for i in range(m):
    cnt = insertion_sort(A, n, G[i], cnt)

   i range(m) range m cnt = insertion_sort(A, n, G[i], cnt) cnt insertion_sort(A, n, G[i], cnt) insertion_sort A n G[i] G i cnt return m, G, cnt return m, G, cnt m G cnt A A n n data = [] data [] for i in range(int(input())):
  data.append(int(input())) i range(int(input())) range int(input()) int input() input data.append(int(input())) data.append data append int(input()) int input() input m, G, cnt = shell_sort(data, len(data)) m shell_sort(data, len(data)) shell_sort data len(data) len data G cnt print(m) print m print(" ".join(map(str, G))) print " ".join(map(str, G)) " ".join " " join map(str, G) map str G print(cnt) print cnt for i in data: print(i) i data cnt = shell_sort(data, len(data)) shell_sort(data, len(data)) cnt def shell_sort(A, n):
  cnt = 0
  G = []
  h = 1
  while h <= n:
    G.append(h)
    h = h * 3 + 1
  m = len(G)
  G = G[::-1]

  for i in range(m):
    cnt = insertion_sort(A, n, G[i], cnt)

  return m, G, cnt def shell_sort(A, n):
  cnt = 0
  G = []
  h = 1
  while h <= n:
    G.append(h)
    h = h * 3 + 1
  m = len(G)
  G = G[::-1]

  for i in range(m):
    cnt = insertion_sort(A, n, G[i], cnt)

  return m, G, cnt shell_sort def insertion_sort(A, n, g, cnt):
  for i in range(g, n):
    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
  return cnt def insertion_sort(A, n, g, cnt):
  for i in range(g, n):
    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
  return cnt insertion_sort m, G, cnt = shell_sort(data, len(data)) shell_sort(data, len(data)) m G, cnt = shell_sort(data, len(data)) shell_sort(data, len(data)) G data = [] [] data
def insertion_sort(A, n, g, cnt):
  for i in range(g, n):
    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
  return cnt

def shell_sort(A, n):
  cnt = 0
  G = []
  h = 1
  while h <= n:
    G.append(h)
    h = h * 3 + 1
  m = len(G)
  G = G[::-1]

  for i in range(m):
    cnt = insertion_sort(A, n, G[i], cnt)

  return m, G, cnt

data = []
for i in range(int(input())):
  data.append(int(input()))

m, G, cnt = shell_sort(data, len(data))
print(m)
print(" ".join(map(str, G)))
print(cnt)
for i in data: print(i)