import math
import sys

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()))
m = 1
b = 0
ct= 0
g = []
while True:
    b = math.ceil( ((9**m) - (4**m))/(5 * (4**(m-1))) )
    if b > n:
        break
    g.append(b)
    m += 1
g = g[::-1]

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

print(m-1)
print(*g, sep=" ")
print(ct)
print(*a, sep="\n") import math math import sys sys 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 m = 1 m 1 b = 0 b 0 ct= 0 ct 0 g = [] g [] while True:
    b = math.ceil( ((9**m) - (4**m))/(5 * (4**(m-1))) )
    if b > n:
        break
    g.append(b)
    m += 1 True b = math.ceil( ((9**m) - (4**m))/(5 * (4**(m-1))) ) b math.ceil( ((9**m) - (4**m))/(5 * (4**(m-1))) ) math.ceil math ceil ((9**m) - (4**m))/(5 * (4**(m-1))) (9**m) - (4**m) 9**m 9 m 4**m 4 m 5 * (4**(m-1)) 5 4**(m-1) 4 m-1 m 1 if b > n:
        break
     b > n b n break g.append(b) g.append g append b m += 1 m 1 g = g[::-1] g g[::-1] g ::-1 -1 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(m-1) print m-1 m 1 print(*g, sep=" ") print *g g sep=" " sep " " print(ct) print ct print(*a, sep="\n") print *a a sep="\n" sep "\n" b = 0 0 b b = math.ceil( ((9**m) - (4**m))/(5 * (4**(m-1))) ) math.ceil( ((9**m) - (4**m))/(5 * (4**(m-1))) ) b ct= 0 0 ct a = list(map(int, sys.stdin.readlines())) list(map(int, sys.stdin.readlines())) a g = [] [] g ct += insertion_sort(a, n, i) insertion_sort(a, n, i) ct n = int(input()) int(input()) n 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 g = g[::-1] g[::-1] g m = 1 1 m m += 1 1 m
import math
import sys

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()))
m = 1
b = 0
ct= 0
g = []
while True:
    b = math.ceil( ((9**m) - (4**m))/(5 * (4**(m-1))) )
    if b > n:
        break
    g.append(b)
    m += 1
g = g[::-1]

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

print(m-1)
print(*g, sep=" ")
print(ct)
print(*a, sep="\n")