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

# shellSort
cnt = 0
n = int(input())
G = [(3 ** i - 1) // 2 for i in range(11, 0, -1) if (3 ** i - 1) // 2 <= n]
m = len(G)
A = [int(input()) for _ in range(n)]
for i in range(m):
    insertionSort(A, n, G[i])
print(m)
print(" ".join(list(map(str, G))))
print(cnt)
for i in range(n):
    print(A[i]) def insertionSort(A, n, g):
    global cnt
    for i in range(g, n):
        v, j = A[i], i - g
        while j >= 0 and A[j] > v:
            A[j + g] = A[j]
            j = j - g
            cnt += 1
        A[j + g] = v

# shellSort insertionSort global cnt for i in range(g, n):
        v, j = A[i], i - g
        while j >= 0 and A[j] > v:
            A[j + g] = A[j]
            j = j - g
            cnt += 1
        A[j + g] = v

# shellSort i range(g, n) range g n v, j = A[i], i - g v A[i] A i 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 cnt = 0 cnt 0 n = int(input()) n int(input()) int input() input (3 ** i - 1) // 2 for i in range(11, 0, -1) if (3 ** i - 1) // 2 <= n for i in range(11, 0, -1) if (3 ** i - 1) // 2 <= n i range(11, 0, -1) range 11 0 -1 (3 ** i - 1) // 2 <= n (3 ** i - 1) // 2 3 ** i - 1 3 ** i 3 i 1 2 n if (3 ** i - 1) // 2 <= n (3 ** i - 1) // 2 3 ** i - 1 3 ** i 3 i 1 2 G = [(3 ** i - 1) // 2 for i in range(11, 0, -1) if (3 ** i - 1) // 2 <= n] G [(3 ** i - 1) // 2 for i in range(11, 0, -1) if (3 ** i - 1) // 2 <= n] m = len(G) m len(G) len G 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)] for i in range(m):
    insertionSort(A, n, G[i]) i range(m) range m insertionSort(A, n, G[i]) insertionSort A n G[i] G i print(m) print m print(" ".join(list(map(str, G)))) print " ".join(list(map(str, G))) " ".join " " join list(map(str, G)) list map(str, G) map str G print(cnt) print cnt for i in range(n):
    print(A[i]) i range(n) range n print(A[i]) print A[i] A i n = int(input()) int(input()) n m = len(G) len(G) m G = [(3 ** i - 1) // 2 for i in range(11, 0, -1) if (3 ** i - 1) // 2 <= n] [(3 ** i - 1) // 2 for i in range(11, 0, -1) if (3 ** i - 1) // 2 <= n] G cnt = 0 0 cnt A = [int(input()) for _ in range(n)] [int(input()) for _ in range(n)] A def insertionSort(A, n, g):
    global cnt
    for i in range(g, n):
        v, j = A[i], i - g
        while j >= 0 and A[j] > v:
            A[j + g] = A[j]
            j = j - g
            cnt += 1
        A[j + g] = v

# shellSort def insertionSort(A, n, g):
    global cnt
    for i in range(g, n):
        v, j = A[i], i - g
        while j >= 0 and A[j] > v:
            A[j + g] = A[j]
            j = j - g
            cnt += 1
        A[j + g] = v

# shellSort insertionSort
def insertionSort(A, n, g):
    global cnt
    for i in range(g, n):
        v, j = A[i], i - g
        while j >= 0 and A[j] > v:
            A[j + g] = A[j]
            j = j - g
            cnt += 1
        A[j + g] = v

# shellSort
cnt = 0
n = int(input())
G = [(3 ** i - 1) // 2 for i in range(11, 0, -1) if (3 ** i - 1) // 2 <= n]
m = len(G)
A = [int(input()) for _ in range(n)]
for i in range(m):
    insertionSort(A, n, G[i])
print(m)
print(" ".join(list(map(str, G))))
print(cnt)
for i in range(n):
    print(A[i])