# coding: utf-8

import math
import sys

def insertionSort(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()))
cnt = 0
m = 0
h = 0
g = []

while True:
    h = 3*h + 1
    if h > n:
        break
    g.insert(0, math.ceil(h))

for i in g:
    cnt += insertionSort(a, n, i)

print(len(g))
print(*g, sep=" ")
print(cnt)
print(*a, sep="\n") import math math import sys sys def insertionSort(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 insertionSort 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
            a[j+g] = v
     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 cnt = 0 cnt 0 m = 0 m 0 h = 0 h 0 g = [] g [] while True:
    h = 3*h + 1
    if h > n:
        break
    g.insert(0, math.ceil(h)) True h = 3*h + 1 h 3*h + 1 3*h 3 h 1 if h > n:
        break
     h > n h n break g.insert(0, math.ceil(h)) g.insert g insert 0 math.ceil(h) math.ceil math ceil h for i in g:
    cnt += insertionSort(a, n, i) i g cnt += insertionSort(a, n, i) cnt insertionSort(a, n, i) insertionSort a n i print(len(g)) print len(g) len g print(*g, sep=" ") print *g g sep=" " sep " " print(cnt) print cnt print(*a, sep="\n") print *a a sep="\n" sep "\n" def insertionSort(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 insertionSort(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 insertionSort cnt += insertionSort(a, n, i) insertionSort(a, n, i) cnt h = 3*h + 1 3*h + 1 h g = [] [] g n = int(input()) int(input()) n h = 0 0 h a = list(map(int, sys.stdin.readlines())) list(map(int, sys.stdin.readlines())) a m = 0 0 m cnt = 0 0 cnt
# coding: utf-8

import math
import sys

def insertionSort(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()))
cnt = 0
m = 0
h = 0
g = []

while True:
    h = 3*h + 1
    if h > n:
        break
    g.insert(0, math.ceil(h))

for i in g:
    cnt += insertionSort(a, n, i)

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