def insertionSort(A, N, g=1):
    global count
    for i in range(g, N):
        v = A[i]
        j = i-g
        while A[j] > v and j >= 0:
            A[j+g], A[j] = A[j], A[j+g]
            count += 1
            j -= g


def bubbleSort(A, N):
    flag = 1
    while flag:
        flag = 0
        for j in range(N-1, 0, -1):
            if A[j] < A[j-1]:
                A[j], A[j-1] = A[j-1], A[j]
                flag = 1


def selectionSort(A, N):
    for i in range(N):
        minidx = i
        for j in range(i, N):
            if A[j] < A[minidx]:
                minidx = j
        A[i], A[minidx] = A[minidx], A[i]


def shellSort_d(N):
    G = [1]
    i = 0
    while True:
        tmp = G[i] * 3 + 1
        if tmp < N:
            G.append(tmp)
            i += 1
        else:
            break
    G.reverse()
    return G


def shellSort(A, N):
    global count, G
    count = 0
    G = shellSort_d(N)
    for g in G:
        insertionSort(A, N, g)


N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

shellSort(A, N)

print(len(G))
print(" ".join(map(str,G)))
print(count)
for a in A:
    print(a) def insertionSort(A, N, g=1):
    global count
    for i in range(g, N):
        v = A[i]
        j = i-g
        while A[j] > v and j >= 0:
            A[j+g], A[j] = A[j], A[j+g]
            count += 1
            j -= g insertionSort global count for i in range(g, N):
        v = A[i]
        j = i-g
        while A[j] > v and j >= 0:
            A[j+g], A[j] = A[j], A[j+g]
            count += 1
            j -= g i range(g, N) range g N v = A[i] v A[i] A i j = i-g j i-g i g while A[j] > v and j >= 0:
            A[j+g], A[j] = A[j], A[j+g]
            count += 1
            j -= g A[j] > v and j >= 0 A[j] > v A[j] A j v j >= 0 j 0 A[j+g], A[j] = A[j], A[j+g] A[j+g] A j+g j g A[j] A j A[j] A j A[j+g] A j+g j g count += 1 count 1 j -= g j g A A N N g=1 g 1 def bubbleSort(A, N):
    flag = 1
    while flag:
        flag = 0
        for j in range(N-1, 0, -1):
            if A[j] < A[j-1]:
                A[j], A[j-1] = A[j-1], A[j]
                flag = 1 bubbleSort flag = 1 flag 1 while flag:
        flag = 0
        for j in range(N-1, 0, -1):
            if A[j] < A[j-1]:
                A[j], A[j-1] = A[j-1], A[j]
                flag = 1 flag flag = 0 flag 0 for j in range(N-1, 0, -1):
            if A[j] < A[j-1]:
                A[j], A[j-1] = A[j-1], A[j]
                flag = 1 j range(N-1, 0, -1) range N-1 N 1 0 -1 if A[j] < A[j-1]:
                A[j], A[j-1] = A[j-1], A[j]
                flag = 1 A[j] < A[j-1] A[j] A j A[j-1] A j-1 j 1 A[j], A[j-1] = A[j-1], A[j] A[j] A j A[j-1] A j-1 j 1 A[j-1] A j-1 j 1 A[j] A j flag = 1 flag 1 A A N N def selectionSort(A, N):
    for i in range(N):
        minidx = i
        for j in range(i, N):
            if A[j] < A[minidx]:
                minidx = j
        A[i], A[minidx] = A[minidx], A[i] selectionSort for i in range(N):
        minidx = i
        for j in range(i, N):
            if A[j] < A[minidx]:
                minidx = j
        A[i], A[minidx] = A[minidx], A[i] i range(N) range N minidx = i minidx i for j in range(i, N):
            if A[j] < A[minidx]:
                minidx = j
         j range(i, N) range i N if A[j] < A[minidx]:
                minidx = j
         A[j] < A[minidx] A[j] A j A[minidx] A minidx minidx = j minidx j A[i], A[minidx] = A[minidx], A[i] A[i] A i A[minidx] A minidx A[minidx] A minidx A[i] A i A A N N def shellSort_d(N):
    G = [1]
    i = 0
    while True:
        tmp = G[i] * 3 + 1
        if tmp < N:
            G.append(tmp)
            i += 1
        else:
            break
    G.reverse()
    return G shellSort_d G = [1] G [1] 1 i = 0 i 0 while True:
        tmp = G[i] * 3 + 1
        if tmp < N:
            G.append(tmp)
            i += 1
        else:
            break
     True tmp = G[i] * 3 + 1 tmp G[i] * 3 + 1 G[i] * 3 G[i] G i 3 1 if tmp < N:
            G.append(tmp)
            i += 1
        else:
            break
     tmp < N tmp N G.append(tmp) G.append G append tmp i += 1 i 1 break G.reverse() G.reverse G reverse return G G N N def shellSort(A, N):
    global count, G
    count = 0
    G = shellSort_d(N)
    for g in G:
        insertionSort(A, N, g) shellSort global count, G count = 0 count 0 G = shellSort_d(N) G shellSort_d(N) shellSort_d N for g in G:
        insertionSort(A, N, g) g G insertionSort(A, N, g) insertionSort A N g A A N N 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 shellSort(A, N) shellSort A N 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(count) print count for a in A:
    print(a) a A print(a) print a def selectionSort(A, N):
    for i in range(N):
        minidx = i
        for j in range(i, N):
            if A[j] < A[minidx]:
                minidx = j
        A[i], A[minidx] = A[minidx], A[i] def selectionSort(A, N):
    for i in range(N):
        minidx = i
        for j in range(i, N):
            if A[j] < A[minidx]:
                minidx = j
        A[i], A[minidx] = A[minidx], A[i] selectionSort def shellSort(A, N):
    global count, G
    count = 0
    G = shellSort_d(N)
    for g in G:
        insertionSort(A, N, g) def shellSort(A, N):
    global count, G
    count = 0
    G = shellSort_d(N)
    for g in G:
        insertionSort(A, N, g) shellSort A = [] [] A def bubbleSort(A, N):
    flag = 1
    while flag:
        flag = 0
        for j in range(N-1, 0, -1):
            if A[j] < A[j-1]:
                A[j], A[j-1] = A[j-1], A[j]
                flag = 1 def bubbleSort(A, N):
    flag = 1
    while flag:
        flag = 0
        for j in range(N-1, 0, -1):
            if A[j] < A[j-1]:
                A[j], A[j-1] = A[j-1], A[j]
                flag = 1 bubbleSort def shellSort_d(N):
    G = [1]
    i = 0
    while True:
        tmp = G[i] * 3 + 1
        if tmp < N:
            G.append(tmp)
            i += 1
        else:
            break
    G.reverse()
    return G def shellSort_d(N):
    G = [1]
    i = 0
    while True:
        tmp = G[i] * 3 + 1
        if tmp < N:
            G.append(tmp)
            i += 1
        else:
            break
    G.reverse()
    return G shellSort_d def insertionSort(A, N, g=1):
    global count
    for i in range(g, N):
        v = A[i]
        j = i-g
        while A[j] > v and j >= 0:
            A[j+g], A[j] = A[j], A[j+g]
            count += 1
            j -= g def insertionSort(A, N, g=1):
    global count
    for i in range(g, N):
        v = A[i]
        j = i-g
        while A[j] > v and j >= 0:
            A[j+g], A[j] = A[j], A[j+g]
            count += 1
            j -= g insertionSort N = int(input()) int(input()) N
def insertionSort(A, N, g=1):
    global count
    for i in range(g, N):
        v = A[i]
        j = i-g
        while A[j] > v and j >= 0:
            A[j+g], A[j] = A[j], A[j+g]
            count += 1
            j -= g


def bubbleSort(A, N):
    flag = 1
    while flag:
        flag = 0
        for j in range(N-1, 0, -1):
            if A[j] < A[j-1]:
                A[j], A[j-1] = A[j-1], A[j]
                flag = 1


def selectionSort(A, N):
    for i in range(N):
        minidx = i
        for j in range(i, N):
            if A[j] < A[minidx]:
                minidx = j
        A[i], A[minidx] = A[minidx], A[i]


def shellSort_d(N):
    G = [1]
    i = 0
    while True:
        tmp = G[i] * 3 + 1
        if tmp < N:
            G.append(tmp)
            i += 1
        else:
            break
    G.reverse()
    return G


def shellSort(A, N):
    global count, G
    count = 0
    G = shellSort_d(N)
    for g in G:
        insertionSort(A, N, g)


N = int(input())
A = []
for i in range(N):
    A.append(int(input()))

shellSort(A, N)

print(len(G))
print(" ".join(map(str,G)))
print(count)
for a in A:
    print(a)
