count = 0
m = 0
G = []
def insertionSort(A, n, g):
    global count
    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
            count += 1
        A[j+g] = v

def shellSort(A, n):
    global count
    global m
    global G
    count = 0
    g = 1
    while g <= n:
        G.append(g)
        g = 3*g + 1
    G.reverse()
    m = len(G)
    for g in G:
        insertionSort(A, n, g)
A = []
n = int(input())
for _ in range(n):
    A.append(int(input()))

shellSort(A,n)

print(m)
print(" ".join(map(str, G)))
print(count)
for a in A:
    print(a)   
    
 count = 0 count 0 m = 0 m 0 G = [] G [] def insertionSort(A, n, g):
    global count
    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
            count += 1
        A[j+g] = v insertionSort global count 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
            count += 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
            count += 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 count += 1 count 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 count
    global m
    global G
    count = 0
    g = 1
    while g <= n:
        G.append(g)
        g = 3*g + 1
    G.reverse()
    m = len(G)
    for g in G:
        insertionSort(A, n, g) shellSort global count global m global G count = 0 count 0 g = 1 g 1 while g <= n:
        G.append(g)
        g = 3*g + 1
     g <= n g n G.append(g) G.append G append g g = 3*g + 1 g 3*g + 1 3*g 3 g 1 G.reverse() G.reverse G reverse m = len(G) m len(G) len G for g in G:
        insertionSort(A, n, g) g G insertionSort(A, n, g) insertionSort A n g A A n n A = [] A [] n = int(input()) n int(input()) int input() input 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 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(count) print count for a in A:
    print(a)   
     a A print(a) print a m = 0 0 m def shellSort(A, n):
    global count
    global m
    global G
    count = 0
    g = 1
    while g <= n:
        G.append(g)
        g = 3*g + 1
    G.reverse()
    m = len(G)
    for g in G:
        insertionSort(A, n, g) def shellSort(A, n):
    global count
    global m
    global G
    count = 0
    g = 1
    while g <= n:
        G.append(g)
        g = 3*g + 1
    G.reverse()
    m = len(G)
    for g in G:
        insertionSort(A, n, g) shellSort def insertionSort(A, n, g):
    global count
    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
            count += 1
        A[j+g] = v def insertionSort(A, n, g):
    global count
    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
            count += 1
        A[j+g] = v insertionSort count = 0 0 count G = [] [] G A = [] [] A n = int(input()) int(input()) n
count = 0
m = 0
G = []
def insertionSort(A, n, g):
    global count
    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
            count += 1
        A[j+g] = v

def shellSort(A, n):
    global count
    global m
    global G
    count = 0
    g = 1
    while g <= n:
        G.append(g)
        g = 3*g + 1
    G.reverse()
    m = len(G)
    for g in G:
        insertionSort(A, n, g)
A = []
n = int(input())
for _ in range(n):
    A.append(int(input()))

shellSort(A,n)

print(m)
print(" ".join(map(str, G)))
print(count)
for a in A:
    print(a)   
    

