N, *A = map(int, open(0).read().split())
cnt = 0


def insertion(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], A[j+g] = A[j+g], A[j]
            cnt += 1
            j -= g


m = 1
G = [1]
while 3*G[-1]+1 < N:
    m += 1
    G.append(3*G[-1]+1)
G = G[::-1]

for g in G:
    insertion(A, N, g)

print(m)
print(*G)
print(cnt)
[print(a) for a in A]
 N, *A = map(int, open(0).read().split()) N map(int, open(0).read().split()) map int open(0).read().split() (0).read().split (0).read() (0).read (0) open 0 read split *A A cnt = 0 cnt 0 def insertion(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], A[j+g] = A[j+g], A[j]
            cnt += 1
            j -= g insertion global cnt for i in range(g, N):
        v = A[i]
        j = i-g
        while j >= 0 and A[j] > v:
            A[j], A[j+g] = A[j+g], A[j]
            cnt += 1
            j -= g 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], A[j+g] = A[j+g], A[j]
            cnt += 1
            j -= g j >= 0 and A[j] > v j >= 0 j 0 A[j] > v A[j] A j v A[j], A[j+g] = A[j+g], A[j] A[j] A j A[j+g] A j+g j g A[j+g] A j+g j g A[j] A j cnt += 1 cnt 1 j -= g j g A A N N g g m = 1 m 1 G = [1] G [1] 1 while 3*G[-1]+1 < N:
    m += 1
    G.append(3*G[-1]+1) 3*G[-1]+1 < N 3*G[-1]+1 3*G[-1] 3 G[-1] G -1 1 N m += 1 m 1 G.append(3*G[-1]+1) G.append G append 3*G[-1]+1 3*G[-1] 3 G[-1] G -1 1 G = G[::-1] G G[::-1] G ::-1 -1 for g in G:
    insertion(A, N, g) g G insertion(A, N, g) insertion A N g print(m) print m print(*G) print *G G print(cnt) print cnt print(a) for a in A for a in A a A for a in A print(a) print a [print(a) for a in A] m += 1 1 m N, *A = map(int, open(0).read().split()) map(int, open(0).read().split()) N m = 1 1 m cnt = 0 0 cnt G = [1] [1] G def insertion(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], A[j+g] = A[j+g], A[j]
            cnt += 1
            j -= g def insertion(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], A[j+g] = A[j+g], A[j]
            cnt += 1
            j -= g insertion G = G[::-1] G[::-1] G
N, *A = map(int, open(0).read().split())
cnt = 0


def insertion(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], A[j+g] = A[j+g], A[j]
            cnt += 1
            j -= g


m = 1
G = [1]
while 3*G[-1]+1 < N:
    m += 1
    G.append(3*G[-1]+1)
G = G[::-1]

for g in G:
    insertion(A, N, g)

print(m)
print(*G)
print(cnt)
[print(a) for a in A]

