cnt = 0
def insertion_sort(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 -= g
            cnt += 1
        A[j+g] = v
def shell_sort(A, n):
    G = [1]
    for i in range(25):
        g = G[-1]*2+1
        if g > len(A)-1:
            break
        G.append(g)
    G.reverse()
    m = len(G)
    for g in G:
        insertion_sort(A, n, g)
    return m, G, A
n = int(input())
A = [int(input()) for _ in range(n)]
m, G, A = shell_sort(A, n)
print(m)
print(" ".join(map(str, G)))
print(cnt)
for a in A:
    print(a) cnt = 0 cnt 0 def insertion_sort(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 -= g
            cnt += 1
        A[j+g] = v insertion_sort 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 -= g
            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 -= g
            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 -= g j g cnt += 1 cnt 1 A[j+g] = v A[j+g] A j+g j g v A A n n g g def shell_sort(A, n):
    G = [1]
    for i in range(25):
        g = G[-1]*2+1
        if g > len(A)-1:
            break
        G.append(g)
    G.reverse()
    m = len(G)
    for g in G:
        insertion_sort(A, n, g)
    return m, G, A shell_sort G = [1] G [1] 1 for i in range(25):
        g = G[-1]*2+1
        if g > len(A)-1:
            break
        G.append(g)
     i range(25) range 25 g = G[-1]*2+1 g G[-1]*2+1 G[-1]*2 G[-1] G -1 2 1 if g > len(A)-1:
            break
         g > len(A)-1 g len(A)-1 len(A) len A 1 break G.append(g) G.append G append g G.reverse() G.reverse G reverse m = len(G) m len(G) len G for g in G:
        insertion_sort(A, n, g)
     g G insertion_sort(A, n, g) insertion_sort A n g return m, G, A return m, G, A m G A A A n n n = int(input()) n int(input()) int input() input int(input()) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) int(input()) int input() input A = [int(input()) for _ in range(n)] A [int(input()) for _ in range(n)] m, G, A = shell_sort(A, n) m shell_sort(A, n) shell_sort A n G A print(m) print m print(" ".join(map(str, G))) print " ".join(map(str, G)) " ".join " " join map(str, G) map str G print(cnt) print cnt for a in A:
    print(a) a A print(a) print a def insertion_sort(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 -= g
            cnt += 1
        A[j+g] = v def insertion_sort(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 -= g
            cnt += 1
        A[j+g] = v insertion_sort m, G, A = shell_sort(A, n) shell_sort(A, n) m def shell_sort(A, n):
    G = [1]
    for i in range(25):
        g = G[-1]*2+1
        if g > len(A)-1:
            break
        G.append(g)
    G.reverse()
    m = len(G)
    for g in G:
        insertion_sort(A, n, g)
    return m, G, A def shell_sort(A, n):
    G = [1]
    for i in range(25):
        g = G[-1]*2+1
        if g > len(A)-1:
            break
        G.append(g)
    G.reverse()
    m = len(G)
    for g in G:
        insertion_sort(A, n, g)
    return m, G, A shell_sort A = [int(input()) for _ in range(n)] [int(input()) for _ in range(n)] A n = int(input()) int(input()) n A = shell_sort(A, n) shell_sort(A, n) A cnt = 0 0 cnt G, A = shell_sort(A, n) shell_sort(A, n) G
cnt = 0
def insertion_sort(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 -= g
            cnt += 1
        A[j+g] = v
def shell_sort(A, n):
    G = [1]
    for i in range(25):
        g = G[-1]*2+1
        if g > len(A)-1:
            break
        G.append(g)
    G.reverse()
    m = len(G)
    for g in G:
        insertion_sort(A, n, g)
    return m, G, A
n = int(input())
A = [int(input()) for _ in range(n)]
m, G, A = shell_sort(A, n)
print(m)
print(" ".join(map(str, G)))
print(cnt)
for a in A:
    print(a)
