def insertionSort(A, n, g):
  ret=0
  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
      ret+=1
      A[j+g] = v
  return ret

n=int(input())
arr=[int(input()) for _ in range(n)]
cnt=0
g=[]
h=1
while h<=n:
  g.append(h)
  h=h*3+1
g=sorted(g,reverse=True)
m=len(g)
for i in range(m):
  cnt+=insertionSort(arr, n, g[i])
print(m)
print(' '.join(map(str,g)))
print(cnt)
for i in range(n):
  print(arr[i]) def insertionSort(A, n, g):
  ret=0
  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
      ret+=1
      A[j+g] = v
  return ret insertionSort ret=0 ret 0 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
      ret+=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
      ret+=1
      A[j+g] = v
   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 ret+=1 ret 1 A[j+g] = v A[j+g] A j+g j g v return ret ret A A n n g g n=int(input()) n int(input()) int input() input int(input()) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) int(input()) int input() input arr=[int(input()) for _ in range(n)] arr [int(input()) for _ in range(n)] 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 g=sorted(g,reverse=True) g sorted(g,reverse=True) sorted g reverse=True reverse True m=len(g) m len(g) len g for i in range(m):
  cnt+=insertionSort(arr, n, g[i]) i range(m) range m cnt+=insertionSort(arr, n, g[i]) cnt insertionSort(arr, n, g[i]) insertionSort arr n g[i] g i 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 range(n):
  print(arr[i]) i range(n) range n print(arr[i]) print arr[i] arr i m=len(g) len(g) m def insertionSort(A, n, g):
  ret=0
  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
      ret+=1
      A[j+g] = v
  return ret def insertionSort(A, n, g):
  ret=0
  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
      ret+=1
      A[j+g] = v
  return ret insertionSort h=1 1 h g=[] [] g g=sorted(g,reverse=True) sorted(g,reverse=True) g cnt+=insertionSort(arr, n, g[i]) insertionSort(arr, n, g[i]) cnt arr=[int(input()) for _ in range(n)] [int(input()) for _ in range(n)] arr n=int(input()) int(input()) n h=h*3+1 h*3+1 h cnt=0 0 cnt
def insertionSort(A, n, g):
  ret=0
  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
      ret+=1
      A[j+g] = v
  return ret

n=int(input())
arr=[int(input()) for _ in range(n)]
cnt=0
g=[]
h=1
while h<=n:
  g.append(h)
  h=h*3+1
g=sorted(g,reverse=True)
m=len(g)
for i in range(m):
  cnt+=insertionSort(arr, n, g[i])
print(m)
print(' '.join(map(str,g)))
print(cnt)
for i in range(n):
  print(arr[i])
