def printing(m, G, cnt, A):
    print(m)
    for i in range(len(G)):
        if i != len(G) - 1:
            print(G[i], end=' ')
        else:
            print(G[i])

    print(cnt)
    for i in A:
        print(i)

def insertionSort(A, n, g, 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 += 1
        A[j+g] = v
    return cnt


def shellSort(A, n, cnt):

    m = 0
    G = [1]
    while True:
        formulate = 3 * G[m] + 1
        if N > formulate:
            G.append(formulate)
        else:
            break
        m += 1

    for i in range(len(G) // 2):
        G[i], G[-1 - i] = G[-1 - i], G[i]

    for i in range(m + 1):
        cnt = insertionSort(A, n, G[i], cnt)

    printing(m + 1, G, cnt, A)


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

# inputList = list(map(int, '''5
# 5 1 4 3 2'''.split()))
# N = inputList.pop(0)

cnt = 0
shellSort(inputList, N, cnt) def printing(m, G, cnt, A):
    print(m)
    for i in range(len(G)):
        if i != len(G) - 1:
            print(G[i], end=' ')
        else:
            print(G[i])

    print(cnt)
    for i in A:
        print(i) printing print(m) print m for i in range(len(G)):
        if i != len(G) - 1:
            print(G[i], end=' ')
        else:
            print(G[i])

     i range(len(G)) range len(G) len G if i != len(G) - 1:
            print(G[i], end=' ')
        else:
            print(G[i])

     i != len(G) - 1 i len(G) - 1 len(G) len G 1 print(G[i], end=' ') print G[i] G i end=' ' end ' ' print(G[i]) print G[i] G i print(cnt) print cnt for i in A:
        print(i) i A print(i) print i m m G G cnt cnt A A def insertionSort(A, n, g, 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 += 1
        A[j+g] = v
    return cnt insertionSort 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 += 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 += 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 += 1 cnt 1 A[j+g] = v A[j+g] A j+g j g v return cnt cnt A A n n g g cnt cnt def shellSort(A, n, cnt):

    m = 0
    G = [1]
    while True:
        formulate = 3 * G[m] + 1
        if N > formulate:
            G.append(formulate)
        else:
            break
        m += 1

    for i in range(len(G) // 2):
        G[i], G[-1 - i] = G[-1 - i], G[i]

    for i in range(m + 1):
        cnt = insertionSort(A, n, G[i], cnt)

    printing(m + 1, G, cnt, A) shellSort m = 0 m 0 G = [1] G [1] 1 while True:
        formulate = 3 * G[m] + 1
        if N > formulate:
            G.append(formulate)
        else:
            break
        m += 1

     True formulate = 3 * G[m] + 1 formulate 3 * G[m] + 1 3 * G[m] 3 G[m] G m 1 if N > formulate:
            G.append(formulate)
        else:
            break
         N > formulate N formulate G.append(formulate) G.append G append formulate break m += 1 m 1 for i in range(len(G) // 2):
        G[i], G[-1 - i] = G[-1 - i], G[i]

     i range(len(G) // 2) range len(G) // 2 len(G) len G 2 G[i], G[-1 - i] = G[-1 - i], G[i] G[i] G i G[-1 - i] G -1 - i -1 i G[-1 - i] G -1 - i -1 i G[i] G i for i in range(m + 1):
        cnt = insertionSort(A, n, G[i], cnt)

     i range(m + 1) range m + 1 m 1 cnt = insertionSort(A, n, G[i], cnt) cnt insertionSort(A, n, G[i], cnt) insertionSort A n G[i] G i cnt printing(m + 1, G, cnt, A) printing m + 1 m 1 G cnt A A A n n cnt cnt N = int(input()) N int(input()) int input() input inputList = [] inputList [] for i in range(N):
    inputList.append(int(input()))

# inputList = list(map(int, '''5
# 5 1 4 3 2'''.split()))
# N = inputList.pop(0) i range(N) range N inputList.append(int(input())) inputList.append inputList append int(input()) int input() input cnt = 0 cnt 0 shellSort(inputList, N, cnt) shellSort inputList N cnt cnt = 0 0 cnt inputList = [] [] inputList N = int(input()) int(input()) N def shellSort(A, n, cnt):

    m = 0
    G = [1]
    while True:
        formulate = 3 * G[m] + 1
        if N > formulate:
            G.append(formulate)
        else:
            break
        m += 1

    for i in range(len(G) // 2):
        G[i], G[-1 - i] = G[-1 - i], G[i]

    for i in range(m + 1):
        cnt = insertionSort(A, n, G[i], cnt)

    printing(m + 1, G, cnt, A) def shellSort(A, n, cnt):

    m = 0
    G = [1]
    while True:
        formulate = 3 * G[m] + 1
        if N > formulate:
            G.append(formulate)
        else:
            break
        m += 1

    for i in range(len(G) // 2):
        G[i], G[-1 - i] = G[-1 - i], G[i]

    for i in range(m + 1):
        cnt = insertionSort(A, n, G[i], cnt)

    printing(m + 1, G, cnt, A) shellSort def insertionSort(A, n, g, 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 += 1
        A[j+g] = v
    return cnt def insertionSort(A, n, g, 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 += 1
        A[j+g] = v
    return cnt insertionSort def printing(m, G, cnt, A):
    print(m)
    for i in range(len(G)):
        if i != len(G) - 1:
            print(G[i], end=' ')
        else:
            print(G[i])

    print(cnt)
    for i in A:
        print(i) def printing(m, G, cnt, A):
    print(m)
    for i in range(len(G)):
        if i != len(G) - 1:
            print(G[i], end=' ')
        else:
            print(G[i])

    print(cnt)
    for i in A:
        print(i) printing
def printing(m, G, cnt, A):
    print(m)
    for i in range(len(G)):
        if i != len(G) - 1:
            print(G[i], end=' ')
        else:
            print(G[i])

    print(cnt)
    for i in A:
        print(i)

def insertionSort(A, n, g, 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 += 1
        A[j+g] = v
    return cnt


def shellSort(A, n, cnt):

    m = 0
    G = [1]
    while True:
        formulate = 3 * G[m] + 1
        if N > formulate:
            G.append(formulate)
        else:
            break
        m += 1

    for i in range(len(G) // 2):
        G[i], G[-1 - i] = G[-1 - i], G[i]

    for i in range(m + 1):
        cnt = insertionSort(A, n, G[i], cnt)

    printing(m + 1, G, cnt, A)


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

# inputList = list(map(int, '''5
# 5 1 4 3 2'''.split()))
# N = inputList.pop(0)

cnt = 0
shellSort(inputList, N, cnt)
