import sys

def insertion_sort(a, n, g):
    count = 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
            count += 1
        a[j+g] = v
    return count

def shell_sort(a, n):
    count = 0
    G = list([int((2.25**i-1)/1.25) for i in range(17, 0, -1)])
    G = [x for x in G if x <= n]
    m = len(G)
    for g in G:
        count += insertion_sort(a, n, g)
    return m, G, count, a

n = int(input())
a = list(map(int, sys.stdin))

m, G, count, a = shell_sort(a, n)
print(len(G))
print(*G)
print(count)
print("\n".join(map(str, a))) import sys sys def insertion_sort(a, n, g):
    count = 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
            count += 1
        a[j+g] = v
    return count insertion_sort count = 0 count 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
            count += 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
            count += 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 count += 1 count 1 a[j+g] = v a[j+g] a j+g j g v return count count a a n n g g def shell_sort(a, n):
    count = 0
    G = list([int((2.25**i-1)/1.25) for i in range(17, 0, -1)])
    G = [x for x in G if x <= n]
    m = len(G)
    for g in G:
        count += insertion_sort(a, n, g)
    return m, G, count, a shell_sort count = 0 count 0 int((2.25**i-1)/1.25) for i in range(17, 0, -1) for i in range(17, 0, -1) i range(17, 0, -1) range 17 0 -1 for i in range(17, 0, -1) int((2.25**i-1)/1.25) int (2.25**i-1)/1.25 2.25**i-1 2.25**i 2.25 i 1 1.25 G = list([int((2.25**i-1)/1.25) for i in range(17, 0, -1)]) G list([int((2.25**i-1)/1.25) for i in range(17, 0, -1)]) list [int((2.25**i-1)/1.25) for i in range(17, 0, -1)] x for x in G if x <= n for x in G if x <= n x G x <= n x n if x <= n x G = [x for x in G if x <= n] G [x for x in G if x <= n] m = len(G) m len(G) len G for g in G:
        count += insertion_sort(a, n, g)
     g G count += insertion_sort(a, n, g) count insertion_sort(a, n, g) insertion_sort a n g return m, G, count, a return m, G, count, a m G count a a a n n n = int(input()) n int(input()) int input() input a = list(map(int, sys.stdin)) a list(map(int, sys.stdin)) list map(int, sys.stdin) map int sys.stdin sys stdin m, G, count, a = shell_sort(a, n) m shell_sort(a, n) shell_sort a n G count a print(len(G)) print len(G) len G print(*G) print *G G print(count) print count print("\n".join(map(str, a))) print "\n".join(map(str, a)) "\n".join "\n" join map(str, a) map str a n = int(input()) int(input()) n a = shell_sort(a, n) shell_sort(a, n) a a = list(map(int, sys.stdin)) list(map(int, sys.stdin)) a G, count, a = shell_sort(a, n) shell_sort(a, n) G def shell_sort(a, n):
    count = 0
    G = list([int((2.25**i-1)/1.25) for i in range(17, 0, -1)])
    G = [x for x in G if x <= n]
    m = len(G)
    for g in G:
        count += insertion_sort(a, n, g)
    return m, G, count, a def shell_sort(a, n):
    count = 0
    G = list([int((2.25**i-1)/1.25) for i in range(17, 0, -1)])
    G = [x for x in G if x <= n]
    m = len(G)
    for g in G:
        count += insertion_sort(a, n, g)
    return m, G, count, a shell_sort m, G, count, a = shell_sort(a, n) shell_sort(a, n) m count, a = shell_sort(a, n) shell_sort(a, n) count def insertion_sort(a, n, g):
    count = 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
            count += 1
        a[j+g] = v
    return count def insertion_sort(a, n, g):
    count = 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
            count += 1
        a[j+g] = v
    return count insertion_sort
import sys

def insertion_sort(a, n, g):
    count = 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
            count += 1
        a[j+g] = v
    return count

def shell_sort(a, n):
    count = 0
    G = list([int((2.25**i-1)/1.25) for i in range(17, 0, -1)])
    G = [x for x in G if x <= n]
    m = len(G)
    for g in G:
        count += insertion_sort(a, n, g)
    return m, G, count, a

n = int(input())
a = list(map(int, sys.stdin))

m, G, count, a = shell_sort(a, n)
print(len(G))
print(*G)
print(count)
print("\n".join(map(str, a)))
