from sys import stdin

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
    g = 1
    G = [g]
    while 3 * g + 1 < n:
        g = 3 * g + 1
        G.append(g)
    m = len(G)
    G.reverse()
    print(m)
    print(' '.join(map(str, G)))
    for i in range(m):
        insertionSort(A, n, G[i])

n =  int(stdin.readline())
A = [int(stdin.readline()) for i in range(n)]

shellSort(A, n)
print(cnt)
for a in A:
    print(a)
 from sys import stdin 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
    g = 1
    G = [g]
    while 3 * g + 1 < n:
        g = 3 * g + 1
        G.append(g)
    m = len(G)
    G.reverse()
    print(m)
    print(' '.join(map(str, G)))
    for i in range(m):
        insertionSort(A, n, G[i]) shellSort global cnt cnt = 0 cnt 0 g = 1 g 1 G = [g] G [g] g while 3 * g + 1 < n:
        g = 3 * g + 1
        G.append(g)
     3 * g + 1 < n 3 * g + 1 3 * g 3 g 1 n g = 3 * g + 1 g 3 * g + 1 3 * g 3 g 1 G.append(g) G.append G append g m = len(G) m len(G) len G G.reverse() G.reverse G reverse print(m) print m print(' '.join(map(str, G))) print ' '.join(map(str, G)) ' '.join ' ' join map(str, G) map str G 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(stdin.readline()) n int(stdin.readline()) int stdin.readline() stdin.readline stdin readline int(stdin.readline()) for i in range(n) for i in range(n) i range(n) range n for i in range(n) int(stdin.readline()) int stdin.readline() stdin.readline stdin readline A = [int(stdin.readline()) for i in range(n)] A [int(stdin.readline()) for i in range(n)] shellSort(A, n) shellSort A n print(cnt) print cnt for a in A:
    print(a) a A print(a) print a 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 A = [int(stdin.readline()) for i in range(n)] [int(stdin.readline()) for i in range(n)] A def shellSort(A, n):
    global cnt
    cnt = 0
    g = 1
    G = [g]
    while 3 * g + 1 < n:
        g = 3 * g + 1
        G.append(g)
    m = len(G)
    G.reverse()
    print(m)
    print(' '.join(map(str, G)))
    for i in range(m):
        insertionSort(A, n, G[i]) def shellSort(A, n):
    global cnt
    cnt = 0
    g = 1
    G = [g]
    while 3 * g + 1 < n:
        g = 3 * g + 1
        G.append(g)
    m = len(G)
    G.reverse()
    print(m)
    print(' '.join(map(str, G)))
    for i in range(m):
        insertionSort(A, n, G[i]) shellSort n =  int(stdin.readline()) int(stdin.readline()) n
from sys import stdin

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
    g = 1
    G = [g]
    while 3 * g + 1 < n:
        g = 3 * g + 1
        G.append(g)
    m = len(G)
    G.reverse()
    print(m)
    print(' '.join(map(str, G)))
    for i in range(m):
        insertionSort(A, n, G[i])

n =  int(stdin.readline())
A = [int(stdin.readline()) for i in range(n)]

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

