cnt = 0

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 -= g
            cnt += 1
        A[j+g] = v


def shellSort(A, n):
    G = [1]
    while G[-1]*3+1 < n:
        G.append(G[-1]*3 + 1)

    for i in range(len(G)-1, -1, -1):
        insertionSort(A, n, G[i])

    G.reverse()

    print len(G)
    print " ".join(map(str, G))
    print cnt


N = int(raw_input())
L = [int(raw_input()) for i in range(N)]

shellSort(L, N)


for i in L:
    print i cnt = 0 cnt 0 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 -= g
            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 -= 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 shellSort(A, n):
    G = [1]
    while G[-1]*3+1 < n:
        G.append(G[-1]*3 + 1)

    for i in range(len(G)-1, -1, -1):
        insertionSort(A, n, G[i])

    G.reverse()

    print len(G)
    print " ".join(map(str, G))
    print cnt shellSort 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 for i in range(len(G)-1, -1, -1):
        insertionSort(A, n, G[i])

     i range(len(G)-1, -1, -1) range len(G)-1 len(G) len G 1 -1 -1 insertionSort(A, n, G[i]) insertionSort A n G[i] G i G.reverse() G.reverse G reverse print len(G) len G print " ".join(map(str, G)) " ".join " " join map(str, G) map str G print A A n n N = int(raw_input()) N int(raw_input()) int raw_input() raw_input int(raw_input()) for i in range(N) for i in range(N) i range(N) range N for i in range(N) int(raw_input()) int raw_input() raw_input L = [int(raw_input()) for i in range(N)] L [int(raw_input()) for i in range(N)] shellSort(L, N) shellSort L N for i in L:
    print i i L print 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 -= g
            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 -= g
            cnt += 1
        A[j+g] = v insertionSort L = [int(raw_input()) for i in range(N)] [int(raw_input()) for i in range(N)] L cnt = 0 0 cnt def shellSort(A, n):
    G = [1]
    while G[-1]*3+1 < n:
        G.append(G[-1]*3 + 1)

    for i in range(len(G)-1, -1, -1):
        insertionSort(A, n, G[i])

    G.reverse()

    print len(G)
    print " ".join(map(str, G))
    print cnt def shellSort(A, n):
    G = [1]
    while G[-1]*3+1 < n:
        G.append(G[-1]*3 + 1)

    for i in range(len(G)-1, -1, -1):
        insertionSort(A, n, G[i])

    G.reverse()

    print len(G)
    print " ".join(map(str, G))
    print cnt shellSort N = int(raw_input()) int(raw_input()) N
cnt = 0

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 -= g
            cnt += 1
        A[j+g] = v


def shellSort(A, n):
    G = [1]
    while G[-1]*3+1 < n:
        G.append(G[-1]*3 + 1)

    for i in range(len(G)-1, -1, -1):
        insertionSort(A, n, G[i])

    G.reverse()

    print len(G)
    print " ".join(map(str, G))
    print cnt


N = int(raw_input())
L = [int(raw_input()) for i in range(N)]

shellSort(L, N)


for i in L:
    print i