import sys
import math

ct= 0
def insertion_sort(a, n, g):
    global ct
    for j in range(0,n-g):
        v = a[j+g]
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j = j-g
            ct += 1
        a[j+g] = v

n = int(input())
a = list(map(int, sys.stdin.readlines()))
b = 701
g = [x for x in [1,4,10,23,57,132,301,701] if x <= n]
while True:
    b = math.floor(2.25*b)
    if b > n:
        break
    g.append(b)
g = g[::-1]

for i in g:
    insertion_sort(a, n, i)

print(len(g))
print(*g, sep=" ")
print(ct)
print(*a, sep="\n") import sys sys import math math ct= 0 ct 0 def insertion_sort(a, n, g):
    global ct
    for j in range(0,n-g):
        v = a[j+g]
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j = j-g
            ct += 1
        a[j+g] = v insertion_sort global ct for j in range(0,n-g):
        v = a[j+g]
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j = j-g
            ct += 1
        a[j+g] = v j range(0,n-g) range 0 n-g n g v = a[j+g] v a[j+g] a j+g j g while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j = j-g
            ct += 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 ct += 1 ct 1 a[j+g] = v a[j+g] a j+g j g v a a n n g g n = int(input()) n int(input()) int input() input a = list(map(int, sys.stdin.readlines())) a list(map(int, sys.stdin.readlines())) list map(int, sys.stdin.readlines()) map int sys.stdin.readlines() sys.stdin.readlines sys.stdin sys stdin readlines b = 701 b 701 x for x in [1,4,10,23,57,132,301,701] if x <= n for x in [1,4,10,23,57,132,301,701] if x <= n x [1,4,10,23,57,132,301,701] 1 4 10 23 57 132 301 701 x <= n x n if x <= n x g = [x for x in [1,4,10,23,57,132,301,701] if x <= n] g [x for x in [1,4,10,23,57,132,301,701] if x <= n] while True:
    b = math.floor(2.25*b)
    if b > n:
        break
    g.append(b) True b = math.floor(2.25*b) b math.floor(2.25*b) math.floor math floor 2.25*b 2.25 b if b > n:
        break
     b > n b n break g.append(b) g.append g append b g = g[::-1] g g[::-1] g ::-1 -1 for i in g:
    insertion_sort(a, n, i) i g insertion_sort(a, n, i) insertion_sort a n i print(len(g)) print len(g) len g print(*g, sep=" ") print *g g sep=" " sep " " print(ct) print ct print(*a, sep="\n") print *a a sep="\n" sep "\n" b = 701 701 b g = g[::-1] g[::-1] g def insertion_sort(a, n, g):
    global ct
    for j in range(0,n-g):
        v = a[j+g]
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j = j-g
            ct += 1
        a[j+g] = v def insertion_sort(a, n, g):
    global ct
    for j in range(0,n-g):
        v = a[j+g]
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j = j-g
            ct += 1
        a[j+g] = v insertion_sort ct= 0 0 ct b = math.floor(2.25*b) math.floor(2.25*b) b a = list(map(int, sys.stdin.readlines())) list(map(int, sys.stdin.readlines())) a n = int(input()) int(input()) n g = [x for x in [1,4,10,23,57,132,301,701] if x <= n] [x for x in [1,4,10,23,57,132,301,701] if x <= n] g
import sys
import math

ct= 0
def insertion_sort(a, n, g):
    global ct
    for j in range(0,n-g):
        v = a[j+g]
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j = j-g
            ct += 1
        a[j+g] = v

n = int(input())
a = list(map(int, sys.stdin.readlines()))
b = 701
g = [x for x in [1,4,10,23,57,132,301,701] if x <= n]
while True:
    b = math.floor(2.25*b)
    if b > n:
        break
    g.append(b)
g = g[::-1]

for i in g:
    insertion_sort(a, n, i)

print(len(g))
print(*g, sep=" ")
print(ct)
print(*a, sep="\n")