import sys
n = int(input())
A = list(map(int, sys.stdin))

cnt = 0
def insertion_sort(L, n, g):
    global cnt
    for i in range(g, n):
        v = L[i]
        j = i - g
        while 0 <= j and v < L[j]:
            L[j+g] = L[j]
            j -= g
            cnt += 1
        L[j+g] = v


def shell_sort(L, n):
    global G
    for i in G:
        insertion_sort(L, n, i)

G = [i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n]
shell_sort(A, n)

print(len(G))
print(' '.join(str(x) for x in G))
print(cnt)
for i in A:
    print(i) import sys sys n = int(input()) n int(input()) int input() input A = list(map(int, sys.stdin)) A list(map(int, sys.stdin)) list map(int, sys.stdin) map int sys.stdin sys stdin cnt = 0 cnt 0 def insertion_sort(L, n, g):
    global cnt
    for i in range(g, n):
        v = L[i]
        j = i - g
        while 0 <= j and v < L[j]:
            L[j+g] = L[j]
            j -= g
            cnt += 1
        L[j+g] = v insertion_sort global cnt for i in range(g, n):
        v = L[i]
        j = i - g
        while 0 <= j and v < L[j]:
            L[j+g] = L[j]
            j -= g
            cnt += 1
        L[j+g] = v i range(g, n) range g n v = L[i] v L[i] L i j = i - g j i - g i g while 0 <= j and v < L[j]:
            L[j+g] = L[j]
            j -= g
            cnt += 1
         0 <= j and v < L[j] 0 <= j 0 j v < L[j] v L[j] L j L[j+g] = L[j] L[j+g] L j+g j g L[j] L j j -= g j g cnt += 1 cnt 1 L[j+g] = v L[j+g] L j+g j g v L L n n g g def shell_sort(L, n):
    global G
    for i in G:
        insertion_sort(L, n, i) shell_sort global G for i in G:
        insertion_sort(L, n, i) i G insertion_sort(L, n, i) insertion_sort L n i L L n n i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n i [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] 262913 65921 16577 4193 1073 281 77 23 8 1 i <= n i n if i <= n i G = [i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n] G [i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n] shell_sort(A, n) shell_sort A n print(len(G)) print len(G) len G print(' '.join(str(x) for x in G)) print ' '.join(str(x) for x in G) ' '.join ' ' join str(x) str x print(cnt) print cnt for i in A:
    print(i) i A print(i) print i def insertion_sort(L, n, g):
    global cnt
    for i in range(g, n):
        v = L[i]
        j = i - g
        while 0 <= j and v < L[j]:
            L[j+g] = L[j]
            j -= g
            cnt += 1
        L[j+g] = v def insertion_sort(L, n, g):
    global cnt
    for i in range(g, n):
        v = L[i]
        j = i - g
        while 0 <= j and v < L[j]:
            L[j+g] = L[j]
            j -= g
            cnt += 1
        L[j+g] = v insertion_sort n = int(input()) int(input()) n cnt = 0 0 cnt def shell_sort(L, n):
    global G
    for i in G:
        insertion_sort(L, n, i) def shell_sort(L, n):
    global G
    for i in G:
        insertion_sort(L, n, i) shell_sort G = [i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n] [i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n] G A = list(map(int, sys.stdin)) list(map(int, sys.stdin)) A
import sys
n = int(input())
A = list(map(int, sys.stdin))

cnt = 0
def insertion_sort(L, n, g):
    global cnt
    for i in range(g, n):
        v = L[i]
        j = i - g
        while 0 <= j and v < L[j]:
            L[j+g] = L[j]
            j -= g
            cnt += 1
        L[j+g] = v


def shell_sort(L, n):
    global G
    for i in G:
        insertion_sort(L, n, i)

G = [i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n]
shell_sort(A, n)

print(len(G))
print(' '.join(str(x) for x in G))
print(cnt)
for i in A:
    print(i)