g_m=0
g_G=[]
g_cnt=0
A=[]
n = int(input())
for i in range(n):
    A.append(int(input()))
def insertionSort(A,n,g):
    global g_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
            g_cnt += 1
        A[j+g]=v
    
def shellSort(A,n):
    m=1
    G=[]
    j=1
    for i in range(0,100):
        G.append(j)
        j=3*j+1
    
    while G[m]<=n:
        m+=1
    G=G[:m]
    G.reverse()
    for i in range(0,m):
        insertionSort(A,n,G[i])
    return A,m,G
A,g_m,g_G=shellSort(A,n)
print(g_m)
print(" ".join(map(str,g_G)))
print(g_cnt)
print(*A,sep="\n") g_m=0 g_m 0 g_G=[] g_G [] g_cnt=0 g_cnt 0 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 def insertionSort(A,n,g):
    global g_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
            g_cnt += 1
        A[j+g]=v
     insertionSort global g_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
            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
            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 g_cnt += 1 g_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):
    m=1
    G=[]
    j=1
    for i in range(0,100):
        G.append(j)
        j=3*j+1
    
    while G[m]<=n:
        m+=1
    G=G[:m]
    G.reverse()
    for i in range(0,m):
        insertionSort(A,n,G[i])
    return A,m,G shellSort m=1 m 1 G=[] G [] j=1 j 1 for i in range(0,100):
        G.append(j)
        j=3*j+1
    
     i range(0,100) range 0 100 G.append(j) G.append G append j j=3*j+1 j 3*j+1 3*j 3 j 1 while G[m]<=n:
        m+=1
     G[m]<=n G[m] G m n m+=1 m 1 G=G[:m] G G[:m] G :m m G.reverse() G.reverse G reverse 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 return A,m,G return A,m,G A m G A A n n A,g_m,g_G=shellSort(A,n) A shellSort(A,n) shellSort A n g_m g_G print(g_m) print g_m print(" ".join(map(str,g_G))) print " ".join(map(str,g_G)) " ".join " " join map(str,g_G) map str g_G print(g_cnt) print g_cnt print(*A,sep="\n") print *A A sep="\n" sep "\n" def insertionSort(A,n,g):
    global g_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
            g_cnt += 1
        A[j+g]=v
     def insertionSort(A,n,g):
    global g_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
            g_cnt += 1
        A[j+g]=v
     insertionSort g_G=shellSort(A,n) shellSort(A,n) g_G n = int(input()) int(input()) n g_m,g_G=shellSort(A,n) shellSort(A,n) g_m g_cnt=0 0 g_cnt g_G=[] [] g_G A=[] [] A def shellSort(A,n):
    m=1
    G=[]
    j=1
    for i in range(0,100):
        G.append(j)
        j=3*j+1
    
    while G[m]<=n:
        m+=1
    G=G[:m]
    G.reverse()
    for i in range(0,m):
        insertionSort(A,n,G[i])
    return A,m,G def shellSort(A,n):
    m=1
    G=[]
    j=1
    for i in range(0,100):
        G.append(j)
        j=3*j+1
    
    while G[m]<=n:
        m+=1
    G=G[:m]
    G.reverse()
    for i in range(0,m):
        insertionSort(A,n,G[i])
    return A,m,G shellSort g_m=0 0 g_m A,g_m,g_G=shellSort(A,n) shellSort(A,n) A
g_m=0
g_G=[]
g_cnt=0
A=[]
n = int(input())
for i in range(n):
    A.append(int(input()))
def insertionSort(A,n,g):
    global g_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
            g_cnt += 1
        A[j+g]=v
    
def shellSort(A,n):
    m=1
    G=[]
    j=1
    for i in range(0,100):
        G.append(j)
        j=3*j+1
    
    while G[m]<=n:
        m+=1
    G=G[:m]
    G.reverse()
    for i in range(0,m):
        insertionSort(A,n,G[i])
    return A,m,G
A,g_m,g_G=shellSort(A,n)
print(g_m)
print(" ".join(map(str,g_G)))
print(g_cnt)
print(*A,sep="\n")