n = int(input())
A = [int(input()) for i in range(n)]
cnt = 0
G = []
g = 0
while 3*g+1 <= n:
    G.append(3*g+1)
    g = 3*g+1
G.reverse()
m = len(G)

def InsertionSort(A, n, g=1):
    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]
            j -= g
            cnt += 1
        A[j+g] = v

def ShellSort(A, n):    
    for i in range(m):
        InsertionSort(A, n, G[i])

ShellSort(A, n)

print(m)
print(*G)
print(cnt)  
print(*A, sep = "\n") n = int(input()) n int(input()) int input() input int(input()) for i in range(n) for i in range(n) i range(n) range n for i in range(n) int(input()) int input() input A = [int(input()) for i in range(n)] A [int(input()) for i in range(n)] cnt = 0 cnt 0 G = [] G [] g = 0 g 0 while 3*g+1 <= n:
    G.append(3*g+1)
    g = 3*g+1 3*g+1 <= n 3*g+1 3*g 3 g 1 n G.append(3*g+1) G.append G append 3*g+1 3*g 3 g 1 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 def InsertionSort(A, n, g=1):
    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]
            j -= g
            cnt += 1
        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]
            j -= 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 -= 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 -= 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=1 g 1 def ShellSort(A, n):    
    for i in range(m):
        InsertionSort(A, n, G[i]) ShellSort for i in range(m):
        InsertionSort(A, n, G[i]) i range(m) range m InsertionSort(A, n, G[i]) InsertionSort A n G[i] G i A A n n ShellSort(A, n) ShellSort A n print(m) print m print(*G) print *G G print(cnt) print cnt print(*A, sep = "\n") print *A A sep = "\n" sep "\n" m = len(G) len(G) m g = 0 0 g A = [int(input()) for i in range(n)] [int(input()) for i in range(n)] A def InsertionSort(A, n, g=1):
    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]
            j -= g
            cnt += 1
        A[j+g] = v def InsertionSort(A, n, g=1):
    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]
            j -= g
            cnt += 1
        A[j+g] = v InsertionSort def ShellSort(A, n):    
    for i in range(m):
        InsertionSort(A, n, G[i]) def ShellSort(A, n):    
    for i in range(m):
        InsertionSort(A, n, G[i]) ShellSort n = int(input()) int(input()) n g = 3*g+1 3*g+1 g cnt = 0 0 cnt G = [] [] G
n = int(input())
A = [int(input()) for i in range(n)]
cnt = 0
G = []
g = 0
while 3*g+1 <= n:
    G.append(3*g+1)
    g = 3*g+1
G.reverse()
m = len(G)

def InsertionSort(A, n, g=1):
    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]
            j -= g
            cnt += 1
        A[j+g] = v

def ShellSort(A, n):    
    for i in range(m):
        InsertionSort(A, n, G[i])

ShellSort(A, n)

print(m)
print(*G)
print(cnt)  
print(*A, sep = "\n")
