def insertionSort(A,n,g,cnt):
    for i in range(g,n):
        v = A[i]
        j = i-g
        while (j>=0)*(A[j]>v):
            A[j+g]=A[j]
            j = j-g
            cnt[0] += 1
        A[j+g] = v
A =[]
N = int(input())
for i in range(N):
    A.append(int(input()))
cnt = [0]
import math
m = math.floor(math.log(N,2))+1
G = [math.ceil(N/2)]
for i in range(1,m-1):
    G.append(math.ceil(G[i-1]/2))
G.append(N-sum(G))
if G[len(G)-1] != 1:
    G[len(G)-1] = 1
for k in range(m):
    insertionSort(A,N,G[k],cnt)
print(m)
for i in range(m):
    print(f"{G[i]}",end=" ")
print(f"\n{cnt[0]}")
for i in range(N):
    print(f"{A[i]}") def insertionSort(A,n,g,cnt):
    for i in range(g,n):
        v = A[i]
        j = i-g
        while (j>=0)*(A[j]>v):
            A[j+g]=A[j]
            j = j-g
            cnt[0] += 1
        A[j+g] = v insertionSort for i in range(g,n):
        v = A[i]
        j = i-g
        while (j>=0)*(A[j]>v):
            A[j+g]=A[j]
            j = j-g
            cnt[0] += 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)*(A[j]>v):
            A[j+g]=A[j]
            j = j-g
            cnt[0] += 1
         (j>=0)*(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[0] += 1 cnt[0] cnt 0 1 A[j+g] = v A[j+g] A j+g j g v A A n n g g cnt cnt A =[] A [] N = int(input()) N int(input()) int input() input 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 cnt = [0] cnt [0] 0 import math math m = math.floor(math.log(N,2))+1 m math.floor(math.log(N,2))+1 math.floor(math.log(N,2)) math.floor math floor math.log(N,2) math.log math log N 2 1 G = [math.ceil(N/2)] G [math.ceil(N/2)] math.ceil(N/2) math.ceil math ceil N/2 N 2 for i in range(1,m-1):
    G.append(math.ceil(G[i-1]/2)) i range(1,m-1) range 1 m-1 m 1 G.append(math.ceil(G[i-1]/2)) G.append G append math.ceil(G[i-1]/2) math.ceil math ceil G[i-1]/2 G[i-1] G i-1 i 1 2 G.append(N-sum(G)) G.append G append N-sum(G) N sum(G) sum G if G[len(G)-1] != 1:
    G[len(G)-1] = 1 G[len(G)-1] != 1 G[len(G)-1] G len(G)-1 len(G) len G 1 1 G[len(G)-1] = 1 G[len(G)-1] G len(G)-1 len(G) len G 1 1 for k in range(m):
    insertionSort(A,N,G[k],cnt) k range(m) range m insertionSort(A,N,G[k],cnt) insertionSort A N G[k] G k cnt print(m) print m for i in range(m):
    print(f"{G[i]}",end=" ") i range(m) range m print(f"{G[i]}",end=" ") print f"{G[i]}" end=" " end " " print(f"\n{cnt[0]}") print f"\n{cnt[0]}" for i in range(N):
    print(f"{A[i]}") i range(N) range N print(f"{A[i]}") print f"{A[i]}" A =[] [] A cnt = [0] [0] cnt m = math.floor(math.log(N,2))+1 math.floor(math.log(N,2))+1 m G = [math.ceil(N/2)] [math.ceil(N/2)] G def insertionSort(A,n,g,cnt):
    for i in range(g,n):
        v = A[i]
        j = i-g
        while (j>=0)*(A[j]>v):
            A[j+g]=A[j]
            j = j-g
            cnt[0] += 1
        A[j+g] = v def insertionSort(A,n,g,cnt):
    for i in range(g,n):
        v = A[i]
        j = i-g
        while (j>=0)*(A[j]>v):
            A[j+g]=A[j]
            j = j-g
            cnt[0] += 1
        A[j+g] = v insertionSort N = int(input()) int(input()) N
def insertionSort(A,n,g,cnt):
    for i in range(g,n):
        v = A[i]
        j = i-g
        while (j>=0)*(A[j]>v):
            A[j+g]=A[j]
            j = j-g
            cnt[0] += 1
        A[j+g] = v
A =[]
N = int(input())
for i in range(N):
    A.append(int(input()))
cnt = [0]
import math
m = math.floor(math.log(N,2))+1
G = [math.ceil(N/2)]
for i in range(1,m-1):
    G.append(math.ceil(G[i-1]/2))
G.append(N-sum(G))
if G[len(G)-1] != 1:
    G[len(G)-1] = 1
for k in range(m):
    insertionSort(A,N,G[k],cnt)
print(m)
for i in range(m):
    print(f"{G[i]}",end=" ")
print(f"\n{cnt[0]}")
for i in range(N):
    print(f"{A[i]}")
