n = int(input())
A = [int(input()) for _ in range(n)]
cnt = 0
G = [797161,265720,88573,29524,9841,3280,1093,364,121,40,13,4,1]
G = [v for v in G if v <= n]
m = len(G)
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(m)
print(*G)
print(cnt)
print(*A, sep='\n') n = int(input()) n int(input()) int input() input int(input()) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) int(input()) int input() input A = [int(input()) for _ in range(n)] A [int(input()) for _ in range(n)] cnt = 0 cnt 0 G = [797161,265720,88573,29524,9841,3280,1093,364,121,40,13,4,1] G [797161,265720,88573,29524,9841,3280,1093,364,121,40,13,4,1] 797161 265720 88573 29524 9841 3280 1093 364 121 40 13 4 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] m = len(G) m len(G) len G 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(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 = [v for v in G if v <= n] [v for v in G if v <= n] G 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 G = [797161,265720,88573,29524,9841,3280,1093,364,121,40,13,4,1] [797161,265720,88573,29524,9841,3280,1093,364,121,40,13,4,1] G n = int(input()) int(input()) n cnt = 0 0 cnt A = [int(input()) for _ in range(n)] [int(input()) for _ in range(n)] A
n = int(input())
A = [int(input()) for _ in range(n)]
cnt = 0
G = [797161,265720,88573,29524,9841,3280,1093,364,121,40,13,4,1]
G = [v for v in G if v <= n]
m = len(G)
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(m)
print(*G)
print(cnt)
print(*A, sep='\n')
