import sys
import math
from collections import deque

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

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

for i in g:
    ct += insertion_sort(a, n, i)

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

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

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

for i in g:
    ct += insertion_sort(a, n, i)

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