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

def shellSort(a, n):
    global cnt
    global G
    global m
    cnt = 0
    G = [1]
    while 3 * G[0] + 1 <= n:
        G = [ 3*G[0]+1 ] + G
    m = len(G)
    for i in range(0, m):
        insertionSort(a, n, G[i])

n = int(input())
a = [int(input()) for i in range(0, n)]

shellSort(a, n)

print(m)
print(*G)
print(cnt)
for i in range(0, n):
    print(a[i]) def insertionSort(a, n, g):
    global cnt
    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
            cnt = cnt + 1
        a[j+g] = v insertionSort global cnt 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
            cnt = cnt + 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
            cnt = cnt + 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 cnt = cnt + 1 cnt cnt + 1 cnt 1 a[j+g] = v a[j+g] a j+g j g v a a n n g g def shellSort(a, n):
    global cnt
    global G
    global m
    cnt = 0
    G = [1]
    while 3 * G[0] + 1 <= n:
        G = [ 3*G[0]+1 ] + G
    m = len(G)
    for i in range(0, m):
        insertionSort(a, n, G[i]) shellSort global cnt global G global m cnt = 0 cnt 0 G = [1] G [1] 1 while 3 * G[0] + 1 <= n:
        G = [ 3*G[0]+1 ] + G
     3 * G[0] + 1 <= n 3 * G[0] + 1 3 * G[0] 3 G[0] G 0 1 n G = [ 3*G[0]+1 ] + G G [ 3*G[0]+1 ] + G [ 3*G[0]+1 ] 3*G[0]+1 3*G[0] 3 G[0] G 0 1 G m = len(G) m len(G) len G for i in range(0, m):
        insertionSort(a, n, G[i]) i range(0, m) range 0 m insertionSort(a, n, G[i]) insertionSort a n G[i] G i a a n n n = int(input()) n int(input()) int input() input int(input()) for i in range(0, n) for i in range(0, n) i range(0, n) range 0 n for i in range(0, n) int(input()) int input() input a = [int(input()) for i in range(0, n)] a [int(input()) for i in range(0, n)] shellSort(a, n) shellSort a n print(m) print m print(*G) print *G G print(cnt) print cnt for i in range(0, n):
    print(a[i]) i range(0, n) range 0 n print(a[i]) print a[i] a i n = int(input()) int(input()) n a = [int(input()) for i in range(0, n)] [int(input()) for i in range(0, n)] a def insertionSort(a, n, g):
    global cnt
    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
            cnt = cnt + 1
        a[j+g] = v def insertionSort(a, n, g):
    global cnt
    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
            cnt = cnt + 1
        a[j+g] = v insertionSort def shellSort(a, n):
    global cnt
    global G
    global m
    cnt = 0
    G = [1]
    while 3 * G[0] + 1 <= n:
        G = [ 3*G[0]+1 ] + G
    m = len(G)
    for i in range(0, m):
        insertionSort(a, n, G[i]) def shellSort(a, n):
    global cnt
    global G
    global m
    cnt = 0
    G = [1]
    while 3 * G[0] + 1 <= n:
        G = [ 3*G[0]+1 ] + G
    m = len(G)
    for i in range(0, m):
        insertionSort(a, n, G[i]) shellSort
def insertionSort(a, n, g):
    global cnt
    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
            cnt = cnt + 1
        a[j+g] = v

def shellSort(a, n):
    global cnt
    global G
    global m
    cnt = 0
    G = [1]
    while 3 * G[0] + 1 <= n:
        G = [ 3*G[0]+1 ] + G
    m = len(G)
    for i in range(0, m):
        insertionSort(a, n, G[i])

n = int(input())
a = [int(input()) for i in range(0, n)]

shellSort(a, n)

print(m)
print(*G)
print(cnt)
for i in range(0, n):
    print(a[i])
