cnt = 0
def insertionSort(A, n, g):
  global 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

def shellSort(A, n):
  global cnt
  cnt = 0
  
  m = 0
  b=n
  while b > 0:
    b = b // 4
    m += 1
    
  G = []
  base = 1
  for i in range(0,m):
    G.insert(0,base)
    base = base * 3 + 1

  print(m)
  strG = [str(i) for i in G]
  print(" ".join(strG))
  for i in range(m):
    insertionSort(A, n, G[i])

N = int(input())
A = list()
for i in range(N):
  A.append(int(input()))

shellSort(A,N)
print(cnt)
for a in A:
  print(a)
        
        
        
         cnt = 0 cnt 0 def insertionSort(A, n, g):
  global 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 insertionSort global 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 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 A A n n g g def shellSort(A, n):
  global cnt
  cnt = 0
  
  m = 0
  b=n
  while b > 0:
    b = b // 4
    m += 1
    
  G = []
  base = 1
  for i in range(0,m):
    G.insert(0,base)
    base = base * 3 + 1

  print(m)
  strG = [str(i) for i in G]
  print(" ".join(strG))
  for i in range(m):
    insertionSort(A, n, G[i]) shellSort global cnt cnt = 0 cnt 0 m = 0 m 0 b=n b n while b > 0:
    b = b // 4
    m += 1
    
   b > 0 b 0 b = b // 4 b b // 4 b 4 m += 1 m 1 G = [] G [] base = 1 base 1 for i in range(0,m):
    G.insert(0,base)
    base = base * 3 + 1

   i range(0,m) range 0 m G.insert(0,base) G.insert G insert 0 base base = base * 3 + 1 base base * 3 + 1 base * 3 base 3 1 print(m) print m str(i) for i in G for i in G i G for i in G str(i) str i strG = [str(i) for i in G] strG [str(i) for i in G] print(" ".join(strG)) print " ".join(strG) " ".join " " join strG for i in range(m):
    insertionSort(A, n, G[i]) i range(m) range m insertionSort(A, n, G[i]) insertionSort A n G[i] G i A A n n N = int(input()) N int(input()) int input() input A = list() A list() list 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(A,N) shellSort A N print(cnt) print cnt for a in A:
  print(a)
        
        
        
         a A print(a) print a N = int(input()) int(input()) N def shellSort(A, n):
  global cnt
  cnt = 0
  
  m = 0
  b=n
  while b > 0:
    b = b // 4
    m += 1
    
  G = []
  base = 1
  for i in range(0,m):
    G.insert(0,base)
    base = base * 3 + 1

  print(m)
  strG = [str(i) for i in G]
  print(" ".join(strG))
  for i in range(m):
    insertionSort(A, n, G[i]) def shellSort(A, n):
  global cnt
  cnt = 0
  
  m = 0
  b=n
  while b > 0:
    b = b // 4
    m += 1
    
  G = []
  base = 1
  for i in range(0,m):
    G.insert(0,base)
    base = base * 3 + 1

  print(m)
  strG = [str(i) for i in G]
  print(" ".join(strG))
  for i in range(m):
    insertionSort(A, n, G[i]) shellSort def insertionSort(A, n, g):
  global 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 def insertionSort(A, n, g):
  global 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 insertionSort cnt = 0 0 cnt A = list() list() A
cnt = 0
def insertionSort(A, n, g):
  global 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

def shellSort(A, n):
  global cnt
  cnt = 0
  
  m = 0
  b=n
  while b > 0:
    b = b // 4
    m += 1
    
  G = []
  base = 1
  for i in range(0,m):
    G.insert(0,base)
    base = base * 3 + 1

  print(m)
  strG = [str(i) for i in G]
  print(" ".join(strG))
  for i in range(m):
    insertionSort(A, n, G[i])

N = int(input())
A = list()
for i in range(N):
  A.append(int(input()))

shellSort(A,N)
print(cnt)
for a in A:
  print(a)
        
        
        
        
