import sys

A = list(map(int, sys.stdin.read().rstrip().split("\n")))
n = A[0]
del A[0]

#shellSort
cnt = 0

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

m = len(G)

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

print(m)
print(*G)
print(cnt)
print("\n".join(map(str, A))) import sys sys A = list(map(int, sys.stdin.read().rstrip().split("\n"))) A list(map(int, sys.stdin.read().rstrip().split("\n"))) list map(int, sys.stdin.read().rstrip().split("\n")) map int sys.stdin.read().rstrip().split("\n") sys.stdin.read().rstrip().split sys.stdin.read().rstrip() sys.stdin.read().rstrip sys.stdin.read() sys.stdin.read sys.stdin sys stdin read rstrip split "\n" n = A[0] n A[0] A 0 del A[0] A[0] A 0 cnt = 0 cnt 0 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] m = len(G) m len(G) len G for i in range(m):
    g = G[i]
    # insertionSort
    for j in range(g, n):
        v = A[j]
        k = j - g
        while (k >= 0) and (A[k] > v):
            A[k + g] = A[k]
            k -= g
            cnt += 1
        A[k + g] = v i range(m) range m g = G[i] g G[i] G i for j in range(g, n):
        v = A[j]
        k = j - g
        while (k >= 0) and (A[k] > v):
            A[k + g] = A[k]
            k -= g
            cnt += 1
        A[k + g] = v j range(g, n) range g n v = A[j] v A[j] A j k = j - g k j - g j g while (k >= 0) and (A[k] > v):
            A[k + g] = A[k]
            k -= g
            cnt += 1
         (k >= 0) and (A[k] > v) k >= 0 k 0 A[k] > v A[k] A k v A[k + g] = A[k] A[k + g] A k + g k g A[k] A k k -= g k g cnt += 1 cnt 1 A[k + g] = v A[k + g] A k + g k g v print(m) print m 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 m = len(G) len(G) m n = A[0] A[0] n g = G[i] G[i] g A = list(map(int, sys.stdin.read().rstrip().split("\n"))) list(map(int, sys.stdin.read().rstrip().split("\n"))) A k = j - g j - g k cnt += 1 1 cnt 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 v = A[j] A[j] v k -= g g k cnt = 0 0 cnt
import sys

A = list(map(int, sys.stdin.read().rstrip().split("\n")))
n = A[0]
del A[0]

#shellSort
cnt = 0

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

m = len(G)

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

print(m)
print(*G)
print(cnt)
print("\n".join(map(str, A)))