n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

def insertionsort(a, n, g):
    global c
    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
            c += 1
        a[j + g] = v

c = 0
g = [1]
while g[-1] * 3 + 1 < n:
    g.append(g[-1] * 3 + 1)
g.reverse()
for i in range(len(g)):
    insertionsort(a, n, g[i])
print(len(g))
print(" ".join(map(str, g)))
print(c)
for i in range(n):
    print(a[i]) n = int(input()) n int(input()) int input() input a = [] a [] for i in range(n):
    a.append(int(input())) i range(n) range n a.append(int(input())) a.append a append int(input()) int input() input def insertionsort(a, n, g):
    global c
    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
            c += 1
        a[j + g] = v insertionsort global c 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
            c += 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
            c += 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 c += 1 c 1 a[j + g] = v a[j + g] a j + g j g v a a n n g g c = 0 c 0 g = [1] g [1] 1 while g[-1] * 3 + 1 < n:
    g.append(g[-1] * 3 + 1) g[-1] * 3 + 1 < n g[-1] * 3 + 1 g[-1] * 3 g[-1] g -1 3 1 n g.append(g[-1] * 3 + 1) g.append g append g[-1] * 3 + 1 g[-1] * 3 g[-1] g -1 3 1 g.reverse() g.reverse g reverse for i in range(len(g)):
    insertionsort(a, n, g[i]) i range(len(g)) range len(g) len g insertionsort(a, n, g[i]) insertionsort a n g[i] g i print(len(g)) print len(g) len g print(" ".join(map(str, g))) print " ".join(map(str, g)) " ".join " " join map(str, g) map str g print(c) print c for i in range(n):
    print(a[i]) i range(n) range n print(a[i]) print a[i] a i n = int(input()) int(input()) n def insertionsort(a, n, g):
    global c
    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
            c += 1
        a[j + g] = v def insertionsort(a, n, g):
    global c
    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
            c += 1
        a[j + g] = v insertionsort g = [1] [1] g a = [] [] a c = 0 0 c
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

def insertionsort(a, n, g):
    global c
    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
            c += 1
        a[j + g] = v

c = 0
g = [1]
while g[-1] * 3 + 1 < n:
    g.append(g[-1] * 3 + 1)
g.reverse()
for i in range(len(g)):
    insertionsort(a, n, g[i])
print(len(g))
print(" ".join(map(str, g)))
print(c)
for i in range(n):
    print(a[i])
