# coding: utf-8
# Your code here!


def insertionSort(A, n, 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
            cnt += 1
        A[j + g] = v
    return A, cnt
        
def shellSort(A, n):
    cnt = 0
    m = n // 3 + 1
    G = [1]
    for i in range(m-1):
        if G[0] * 3 + 1 < n:
            G.insert(0, G[0] * 3 + 1)
    m = len(G)
    print(m)
    if m > 1:
        for i in range(m-1):
            print(str(G[i]), end = " ")
    print(str(G[m-1]))
        
    for i in range(m):
        A, cnt = insertionSort(A, n, G[i], cnt)


    print(cnt)
    for i in range(n):
        print(A[i])
    
    
#A = [1, 6, 5, 4, 3, 2]
#n = len(A)

n = int(input())
A = []
#cnt = 0
for i in range(n):
    A.append(int(input()))

shellSort(A, n)





 def insertionSort(A, n, 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
            cnt += 1
        A[j + g] = v
    return A, cnt
         insertionSort 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
            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
            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 cnt += 1 cnt 1 A[j + g] = v A[j + g] A j + g j g v return A, cnt return A, cnt A cnt A A n n g g cnt cnt def shellSort(A, n):
    cnt = 0
    m = n // 3 + 1
    G = [1]
    for i in range(m-1):
        if G[0] * 3 + 1 < n:
            G.insert(0, G[0] * 3 + 1)
    m = len(G)
    print(m)
    if m > 1:
        for i in range(m-1):
            print(str(G[i]), end = " ")
    print(str(G[m-1]))
        
    for i in range(m):
        A, cnt = insertionSort(A, n, G[i], cnt)


    print(cnt)
    for i in range(n):
        print(A[i])
    
    
#A = [1, 6, 5, 4, 3, 2]
#n = len(A) shellSort cnt = 0 cnt 0 m = n // 3 + 1 m n // 3 + 1 n // 3 n 3 1 G = [1] G [1] 1 for i in range(m-1):
        if G[0] * 3 + 1 < n:
            G.insert(0, G[0] * 3 + 1)
     i range(m-1) range m-1 m 1 if G[0] * 3 + 1 < n:
            G.insert(0, G[0] * 3 + 1)
     G[0] * 3 + 1 < n G[0] * 3 + 1 G[0] * 3 G[0] G 0 3 1 n G.insert(0, G[0] * 3 + 1) G.insert G insert 0 G[0] * 3 + 1 G[0] * 3 G[0] G 0 3 1 m = len(G) m len(G) len G print(m) print m if m > 1:
        for i in range(m-1):
            print(str(G[i]), end = " ")
     m > 1 m 1 for i in range(m-1):
            print(str(G[i]), end = " ")
     i range(m-1) range m-1 m 1 print(str(G[i]), end = " ") print str(G[i]) str G[i] G i end = " " end " " print(str(G[m-1])) print str(G[m-1]) str G[m-1] G m-1 m 1 for i in range(m):
        A, cnt = insertionSort(A, n, G[i], cnt)


     i range(m) range m A, cnt = insertionSort(A, n, G[i], cnt) A insertionSort(A, n, G[i], cnt) insertionSort A n G[i] G i cnt cnt print(cnt) print cnt for i in range(n):
        print(A[i])
    
    
#A = [1, 6, 5, 4, 3, 2]
#n = len(A) i range(n) range n print(A[i]) print A[i] A i A A n n n = int(input()) n int(input()) int input() input A = [] A [] 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 shellSort(A, n) shellSort A n A = [] [] A def insertionSort(A, n, 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
            cnt += 1
        A[j + g] = v
    return A, cnt
         def insertionSort(A, n, 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
            cnt += 1
        A[j + g] = v
    return A, cnt
         insertionSort n = int(input()) int(input()) n def shellSort(A, n):
    cnt = 0
    m = n // 3 + 1
    G = [1]
    for i in range(m-1):
        if G[0] * 3 + 1 < n:
            G.insert(0, G[0] * 3 + 1)
    m = len(G)
    print(m)
    if m > 1:
        for i in range(m-1):
            print(str(G[i]), end = " ")
    print(str(G[m-1]))
        
    for i in range(m):
        A, cnt = insertionSort(A, n, G[i], cnt)


    print(cnt)
    for i in range(n):
        print(A[i])
    
    
#A = [1, 6, 5, 4, 3, 2]
#n = len(A) def shellSort(A, n):
    cnt = 0
    m = n // 3 + 1
    G = [1]
    for i in range(m-1):
        if G[0] * 3 + 1 < n:
            G.insert(0, G[0] * 3 + 1)
    m = len(G)
    print(m)
    if m > 1:
        for i in range(m-1):
            print(str(G[i]), end = " ")
    print(str(G[m-1]))
        
    for i in range(m):
        A, cnt = insertionSort(A, n, G[i], cnt)


    print(cnt)
    for i in range(n):
        print(A[i])
    
    
#A = [1, 6, 5, 4, 3, 2]
#n = len(A) shellSort
# coding: utf-8
# Your code here!


def insertionSort(A, n, 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
            cnt += 1
        A[j + g] = v
    return A, cnt
        
def shellSort(A, n):
    cnt = 0
    m = n // 3 + 1
    G = [1]
    for i in range(m-1):
        if G[0] * 3 + 1 < n:
            G.insert(0, G[0] * 3 + 1)
    m = len(G)
    print(m)
    if m > 1:
        for i in range(m-1):
            print(str(G[i]), end = " ")
    print(str(G[m-1]))
        
    for i in range(m):
        A, cnt = insertionSort(A, n, G[i], cnt)


    print(cnt)
    for i in range(n):
        print(A[i])
    
    
#A = [1, 6, 5, 4, 3, 2]
#n = len(A)

n = int(input())
A = []
#cnt = 0
for i in range(n):
    A.append(int(input()))

shellSort(A, n)






