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

m = [1]
for i in range(1, 100):
  m.append(3 * m[-1] + 1)
m = list(reversed([x for x in m if x <= n]))

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

def shellSort(arr, n):
  for i in range(len(m)):
    insertionSort(arr, n, m[i])

shellSort(arr, n)

print(len(m))
print(' '.join([str(x) for x in m]))
print(cnt)
for i in range(len(arr)):
  print (arr[i]) n = int(input()) n int(input()) int input() input arr = [] arr [] for i in range(n):
  arr.append(int(input())) i range(n) range n arr.append(int(input())) arr.append arr append int(input()) int input() input m = [1] m [1] 1 for i in range(1, 100):
  m.append(3 * m[-1] + 1) i range(1, 100) range 1 100 m.append(3 * m[-1] + 1) m.append m append 3 * m[-1] + 1 3 * m[-1] 3 m[-1] m -1 1 x for x in m if x <= n for x in m if x <= n x m x <= n x n if x <= n x m = list(reversed([x for x in m if x <= n])) m list(reversed([x for x in m if x <= n])) list reversed([x for x in m if x <= n]) reversed [x for x in m if x <= n] cnt = 0 cnt 0 def insertionSort(arr, n, g):
  for i in range(g, n):
    v = arr[i]
    j = i - g
    while j >= 0 and arr[j] > v:
      arr[j + g] = arr[j]
      j = j - g
      global cnt
      cnt += 1
    arr[j+g] = v insertionSort for i in range(g, n):
    v = arr[i]
    j = i - g
    while j >= 0 and arr[j] > v:
      arr[j + g] = arr[j]
      j = j - g
      global cnt
      cnt += 1
    arr[j+g] = v i range(g, n) range g n v = arr[i] v arr[i] arr i j = i - g j i - g i g while j >= 0 and arr[j] > v:
      arr[j + g] = arr[j]
      j = j - g
      global cnt
      cnt += 1
     j >= 0 and arr[j] > v j >= 0 j 0 arr[j] > v arr[j] arr j v arr[j + g] = arr[j] arr[j + g] arr j + g j g arr[j] arr j j = j - g j j - g j g global cnt cnt += 1 cnt 1 arr[j+g] = v arr[j+g] arr j+g j g v arr arr n n g g def shellSort(arr, n):
  for i in range(len(m)):
    insertionSort(arr, n, m[i]) shellSort for i in range(len(m)):
    insertionSort(arr, n, m[i]) i range(len(m)) range len(m) len m insertionSort(arr, n, m[i]) insertionSort arr n m[i] m i arr arr n n shellSort(arr, n) shellSort arr n print(len(m)) print len(m) len m str(x) for x in m for x in m x m for x in m str(x) str x print(' '.join([str(x) for x in m])) print ' '.join([str(x) for x in m]) ' '.join ' ' join [str(x) for x in m] print(cnt) print cnt for i in range(len(arr)):
  print (arr[i]) i range(len(arr)) range len(arr) len arr print (arr[i]) print arr[i] arr i m = [1] [1] m n = int(input()) int(input()) n arr = [] [] arr m = list(reversed([x for x in m if x <= n])) list(reversed([x for x in m if x <= n])) m def shellSort(arr, n):
  for i in range(len(m)):
    insertionSort(arr, n, m[i]) def shellSort(arr, n):
  for i in range(len(m)):
    insertionSort(arr, n, m[i]) shellSort cnt = 0 0 cnt def insertionSort(arr, n, g):
  for i in range(g, n):
    v = arr[i]
    j = i - g
    while j >= 0 and arr[j] > v:
      arr[j + g] = arr[j]
      j = j - g
      global cnt
      cnt += 1
    arr[j+g] = v def insertionSort(arr, n, g):
  for i in range(g, n):
    v = arr[i]
    j = i - g
    while j >= 0 and arr[j] > v:
      arr[j + g] = arr[j]
      j = j - g
      global cnt
      cnt += 1
    arr[j+g] = v insertionSort
n = int(input())
arr = []
for i in range(n):
  arr.append(int(input()))

m = [1]
for i in range(1, 100):
  m.append(3 * m[-1] + 1)
m = list(reversed([x for x in m if x <= n]))

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

def shellSort(arr, n):
  for i in range(len(m)):
    insertionSort(arr, n, m[i])

shellSort(arr, n)

print(len(m))
print(' '.join([str(x) for x in m]))
print(cnt)
for i in range(len(arr)):
  print (arr[i])
