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

N = int(raw_input())
A = []
for _ in range(N):
  A += [int(raw_input())]

h = 1 
g = []
g.append(h)
while 3*h+1 < N:
  h = 3*h+1
  g.append(h)

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

N = int(raw_input())
A = []
for _ in range(N):
  A += [int(raw_input())]

h = 1 
g = []
g.append(h)
while 3*h+1 < N:
  h = 3*h+1
  g.append(h)

g.reverse()
print len(g)
print ' '.join(map(str, g)) 
cnt = 0
for G in g:
  cnt += insertionSort(A, N, G)
print cnt
print '\n'.join(map(str, A)) 
