from sys import stdin, maxsize


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


n = int(input())
A = [int(stdin.readline()) for i in range(n)]

G = [1]
for j in range(maxsize):
    k = 2**j + 1
    if k > n: break
    G += [k]

G.reverse()
m = len(G)

cnt = 0
for g in G:
    cnt += insertion_sort(A, n, g)

print(m)
print(*G)
print(cnt)
print("\n".join(map(str, A)))
 from sys import stdin, maxsize def insertion_sort(A, n, g):
    cnt = 0
    for i in range(n):
        j = i
        tmp = A[j]
        while j - g >= 0 and A[j - g] > tmp:
            A[j] = A[j - g]
            j -= g
            cnt += 1
        A[j] = tmp
    return cnt insertion_sort cnt = 0 cnt 0 for i in range(n):
        j = i
        tmp = A[j]
        while j - g >= 0 and A[j - g] > tmp:
            A[j] = A[j - g]
            j -= g
            cnt += 1
        A[j] = tmp
     i range(n) range n j = i j i tmp = A[j] tmp A[j] A j while j - g >= 0 and A[j - g] > tmp:
            A[j] = A[j - g]
            j -= g
            cnt += 1
         j - g >= 0 and A[j - g] > tmp j - g >= 0 j - g j g 0 A[j - g] > tmp A[j - g] A j - g j g tmp A[j] = A[j - g] A[j] A j A[j - g] A j - g j g j -= g j g cnt += 1 cnt 1 A[j] = tmp A[j] A j tmp return cnt cnt A A n n g g n = int(input()) n int(input()) int input() input int(stdin.readline()) for i in range(n) for i in range(n) i range(n) range n for i in range(n) int(stdin.readline()) int stdin.readline() stdin.readline stdin readline A = [int(stdin.readline()) for i in range(n)] A [int(stdin.readline()) for i in range(n)] G = [1] G [1] 1 for j in range(maxsize):
    k = 2**j + 1
    if k > n: break
    G += [k] j range(maxsize) range maxsize k = 2**j + 1 k 2**j + 1 2**j 2 j 1 if k > n: break
     k > n k n G += [k] G [k] k G.reverse() G.reverse G reverse m = len(G) m len(G) len G cnt = 0 cnt 0 for g in G:
    cnt += insertion_sort(A, n, g) g G cnt += insertion_sort(A, n, g) cnt insertion_sort(A, n, g) insertion_sort A n g 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 G = [1] [1] G cnt = 0 0 cnt cnt += insertion_sort(A, n, g) insertion_sort(A, n, g) cnt A = [int(stdin.readline()) for i in range(n)] [int(stdin.readline()) for i in range(n)] A k = 2**j + 1 2**j + 1 k def insertion_sort(A, n, g):
    cnt = 0
    for i in range(n):
        j = i
        tmp = A[j]
        while j - g >= 0 and A[j - g] > tmp:
            A[j] = A[j - g]
            j -= g
            cnt += 1
        A[j] = tmp
    return cnt def insertion_sort(A, n, g):
    cnt = 0
    for i in range(n):
        j = i
        tmp = A[j]
        while j - g >= 0 and A[j - g] > tmp:
            A[j] = A[j - g]
            j -= g
            cnt += 1
        A[j] = tmp
    return cnt insertion_sort G += [k] [k] G m = len(G) len(G) m n = int(input()) int(input()) n
from sys import stdin, maxsize


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


n = int(input())
A = [int(stdin.readline()) for i in range(n)]

G = [1]
for j in range(maxsize):
    k = 2**j + 1
    if k > n: break
    G += [k]

G.reverse()
m = len(G)

cnt = 0
for g in G:
    cnt += insertion_sort(A, n, g)

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

