import math

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]
            cnt += 1
            j -= g
        A[j+g] = v

def shellSort(A, n):
    g = int(n/2) + 1
    G = []
        
    while g > 0:
        G.append(g)
        insertionSort(A, n, g)
        g = int(g/2)
    
    return G

n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
G = shellSort(A,n)

print(len(G))
print(" ".join(map(str, G)))
print(cnt)
for i in A:
    print(i) import math math 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]
            cnt += 1
            j -= g
        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]
            cnt += 1
            j -= g
        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]
            cnt += 1
            j -= g
         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 cnt += 1 cnt 1 j -= g j g A[j+g] = v A[j+g] A j+g j g v A A n n g g def shellSort(A, n):
    g = int(n/2) + 1
    G = []
        
    while g > 0:
        G.append(g)
        insertionSort(A, n, g)
        g = int(g/2)
    
    return G shellSort g = int(n/2) + 1 g int(n/2) + 1 int(n/2) int n/2 n 2 1 G = [] G [] while g > 0:
        G.append(g)
        insertionSort(A, n, g)
        g = int(g/2)
    
     g > 0 g 0 G.append(g) G.append G append g insertionSort(A, n, g) insertionSort A n g g = int(g/2) g int(g/2) int g/2 g 2 return G G A A n n n = int(input()) n int(input()) int input() input A = [] A [] for _ in range(n):
    A.append(int(input())) _ range(n) range n A.append(int(input())) A.append A append int(input()) int input() input G = shellSort(A,n) G shellSort(A,n) shellSort A n print(len(G)) print len(G) len G 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 A:
    print(i) i A print(i) print i A = [] [] A G = shellSort(A,n) shellSort(A,n) G 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]
            cnt += 1
            j -= g
        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]
            cnt += 1
            j -= g
        A[j+g] = v insertionSort cnt = 0 0 cnt def shellSort(A, n):
    g = int(n/2) + 1
    G = []
        
    while g > 0:
        G.append(g)
        insertionSort(A, n, g)
        g = int(g/2)
    
    return G def shellSort(A, n):
    g = int(n/2) + 1
    G = []
        
    while g > 0:
        G.append(g)
        insertionSort(A, n, g)
        g = int(g/2)
    
    return G shellSort n = int(input()) int(input()) n
import math

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]
            cnt += 1
            j -= g
        A[j+g] = v

def shellSort(A, n):
    g = int(n/2) + 1
    G = []
        
    while g > 0:
        G.append(g)
        insertionSort(A, n, g)
        g = int(g/2)
    
    return G

n = int(input())
A = []
for _ in range(n):
    A.append(int(input()))
G = shellSort(A,n)

print(len(G))
print(" ".join(map(str, G)))
print(cnt)
for i in A:
    print(i)
