import sys
n = int(input())
A = list(map(int,sys.stdin))
cnt = 0
G = [int((2.15**i-1)/1.15)for i in range(17,0,-1)]
G = [v for v in G if v <= n]
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
for g in G:
    insertionSort(A, n, g)
print(len(G))
print(*G)
print(cnt)
print('\n'.join(map(str,A))) 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 int((2.15**i-1)/1.15)for i in range(17,0,-1) for i in range(17,0,-1) i range(17,0,-1) range 17 0 -1 for i in range(17,0,-1) int((2.15**i-1)/1.15) int (2.15**i-1)/1.15 2.15**i-1 2.15**i 2.15 i 1 1.15 G = [int((2.15**i-1)/1.15)for i in range(17,0,-1)] G [int((2.15**i-1)/1.15)for i in range(17,0,-1)] v for v in G if v <= n for v in G if v <= n v G v <= n v n if v <= n v G = [v for v in G if v <= n] G [v for v in G if v <= n] 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 for g in G:
    insertionSort(A, n, g) g G insertionSort(A, n, g) insertionSort A n g print(len(G)) print len(G) len G print(*G) print *G G print(cnt) print cnt print('\n'.join(map(str,A))) print '\n'.join(map(str,A)) '\n'.join '\n' join map(str,A) map str A A = list(map(int,sys.stdin)) list(map(int,sys.stdin)) A cnt = 0 0 cnt G = [int((2.15**i-1)/1.15)for i in range(17,0,-1)] [int((2.15**i-1)/1.15)for i in range(17,0,-1)] G G = [v for v in G if v <= n] [v for v in G if v <= n] G n = int(input()) int(input()) n 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
import sys
n = int(input())
A = list(map(int,sys.stdin))
cnt = 0
G = [int((2.15**i-1)/1.15)for i in range(17,0,-1)]
G = [v for v in G if v <= n]
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
for g in G:
    insertionSort(A, n, g)
print(len(G))
print(*G)
print(cnt)
print('\n'.join(map(str,A)))
