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

def shellSort(A, n):
    global m, G
    for i in range(0, m): 
        insertionSort(A, n, G[i])

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

G = []
h = 1
for i in range(1, 999999):
    if h > n:
        break
    G.append(h)
    h = 3 * h + 1

G.reverse()

cnt = 0
m = len(G)
shellSort(A, n)
'''
m = 2
G = (4,1)
shellSort(A, n)
'''

print(m)
print(" ".join(map(str, G)))
print(cnt)
for i in range(0, n):
    print(A[i]) def insertionSort(A, n, g):
    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 = 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 = 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 A A n n g g def shellSort(A, n):
    global m, G
    for i in range(0, m): 
        insertionSort(A, n, G[i]) shellSort global m, G 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 A A n n n = int(input()) n int(input()) int input() input A = [] A [] for i in range(0, n):
    A.append(int(input())) i range(0, n) range 0 n A.append(int(input())) A.append A append int(input()) int input() input G = [] G [] h = 1 h 1 for i in range(1, 999999):
    if h > n:
        break
    G.append(h)
    h = 3 * h + 1 i range(1, 999999) range 1 999999 if h > n:
        break
     h > n h n break G.append(h) G.append G append h h = 3 * h + 1 h 3 * h + 1 3 * h 3 h 1 G.reverse() G.reverse G reverse cnt = 0 cnt 0 m = len(G) m len(G) len G shellSort(A, n) shellSort A n '''
m = 2
G = (4,1)
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(cnt) print cnt for i in range(0, n):
    print(A[i]) i range(0, n) range 0 n print(A[i]) print A[i] A i h = 3 * h + 1 3 * h + 1 h cnt = 0 0 cnt G = [] [] G h = 1 1 h def insertionSort(A, n, g):
    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 = j - g
            cnt += 1
        A[j + g] = v def insertionSort(A, n, g):
    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 = j - g
            cnt += 1
        A[j + g] = v insertionSort A = [] [] A n = int(input()) int(input()) n def shellSort(A, n):
    global m, G
    for i in range(0, m): 
        insertionSort(A, n, G[i]) def shellSort(A, n):
    global m, G
    for i in range(0, m): 
        insertionSort(A, n, G[i]) shellSort m = len(G) len(G) m
def insertionSort(A, n, g):
    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 = j - g
            cnt += 1
        A[j + g] = v

def shellSort(A, n):
    global m, G
    for i in range(0, m): 
        insertionSort(A, n, G[i])

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

G = []
h = 1
for i in range(1, 999999):
    if h > n:
        break
    G.append(h)
    h = 3 * h + 1

G.reverse()

cnt = 0
m = len(G)
shellSort(A, n)
'''
m = 2
G = (4,1)
shellSort(A, n)
'''

print(m)
print(" ".join(map(str, G)))
print(cnt)
for i in range(0, n):
    print(A[i])