import sys

def insertionSort(A, n, g):
    for i in range(g, n):
        global cnt
        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 m
    global G
    for i in range(0, m):
        insertionSort(A, n, G[i])


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

if n == 1:
    print(1)
    print(1)
    print(0)
    print(A[0])
    sys.exit()
t = n - 1
G = []
G.append(t)
while t != 1:
    t = t//2
    G.append(t)
m = len(G)

cnt = 0
shellSort(A, n)
print(m)
print(' '.join(map(str, G)))
print(cnt)
for i in range(n):
    print(A[i])
 import sys sys def insertionSort(A, n, g):
    for i in range(g, n):
        global cnt
        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 for i in range(g, n):
        global cnt
        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 global cnt 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 m
    global G
    for i in range(0, m):
        insertionSort(A, n, G[i]) shellSort global m global G for i in range(0, m):
        insertionSort(A, n, G[i]) i range(0, m) range 0 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 = [] A [] 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 if n == 1:
    print(1)
    print(1)
    print(0)
    print(A[0])
    sys.exit() n == 1 n 1 print(1) print 1 print(1) print 1 print(0) print 0 print(A[0]) print A[0] A 0 sys.exit() sys.exit sys exit t = n - 1 t n - 1 n 1 G = [] G [] G.append(t) G.append G append t while t != 1:
    t = t//2
    G.append(t) t != 1 t 1 t = t//2 t t//2 t 2 G.append(t) G.append G append t m = len(G) m len(G) len G cnt = 0 cnt 0 shellSort(A, n) shellSort A n 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(A[i]) i range(n) range n print(A[i]) print A[i] A i t = t//2 t//2 t n = int(input()) int(input()) n G = [] [] G def shellSort(A, n):
    global m
    global G
    for i in range(0, m):
        insertionSort(A, n, G[i]) def shellSort(A, n):
    global m
    global G
    for i in range(0, m):
        insertionSort(A, n, G[i]) shellSort cnt = 0 0 cnt A = [] [] A def insertionSort(A, n, g):
    for i in range(g, n):
        global cnt
        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):
    for i in range(g, n):
        global cnt
        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 t = n - 1 n - 1 t m = len(G) len(G) m
import sys

def insertionSort(A, n, g):
    for i in range(g, n):
        global cnt
        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 m
    global G
    for i in range(0, m):
        insertionSort(A, n, G[i])


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

if n == 1:
    print(1)
    print(1)
    print(0)
    print(A[0])
    sys.exit()
t = n - 1
G = []
G.append(t)
while t != 1:
    t = t//2
    G.append(t)
m = len(G)

cnt = 0
shellSort(A, n)
print(m)
print(' '.join(map(str, G)))
print(cnt)
for i in range(n):
    print(A[i])

