# coding: utf-8
# Shell Sort 2018/3/15

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

def shellSort(A, n):
    global cnt
    cnt = 0
    if n == 1:
        G = [1]
    else:
        G = []
        h = 1
        while h < n:
            G.append(h)
            h = 3*h +1
        G = G[::-1]
    m = len(G)
    print m
    print " ".join([str(i) for i in G])
    for i in range(m):
        insertionSort(A, n, G[i])

if __name__ == "__main__":
    n = int(raw_input())
    A = []
    for i in range(n):
        A.append(int(raw_input()))
    shellSort(A, n)
    print cnt
    for i in A:
        print i
 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 = 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 = 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 A A n n g g def shellSort(A, n):
    global cnt
    cnt = 0
    if n == 1:
        G = [1]
    else:
        G = []
        h = 1
        while h < n:
            G.append(h)
            h = 3*h +1
        G = G[::-1]
    m = len(G)
    print m
    print " ".join([str(i) for i in G])
    for i in range(m):
        insertionSort(A, n, G[i]) shellSort global cnt cnt = 0 cnt 0 if n == 1:
        G = [1]
    else:
        G = []
        h = 1
        while h < n:
            G.append(h)
            h = 3*h +1
        G = G[::-1]
     n == 1 n 1 G = [1] G [1] 1 G = [] G [] h = 1 h 1 while h < n:
            G.append(h)
            h = 3*h +1
         h < n h n G.append(h) G.append G append h h = 3*h +1 h 3*h +1 3*h 3 h 1 G = G[::-1] G G[::-1] G ::-1 -1 m = len(G) m len(G) len G print print str(i) for i in G for i in G i G for i in G str(i) str i " ".join([str(i) for i in G]) " ".join " " join [str(i) for i in G] for i in range(m):
        insertionSort(A, n, G[i]) i range(m) range m insertionSort(A, n, G[i]) insertionSort A n G[i] G i A A n n if __name__ == "__main__":
    n = int(raw_input())
    A = []
    for i in range(n):
        A.append(int(raw_input()))
    shellSort(A, n)
    print cnt
    for i in A:
        print i __name__ == "__main__" __name__ "__main__" n = int(raw_input()) n int(raw_input()) int raw_input() raw_input A = [] A [] for i in range(n):
        A.append(int(raw_input()))
     i range(n) range n A.append(int(raw_input())) A.append A append int(raw_input()) int raw_input() raw_input shellSort(A, n) shellSort A n print for i in A:
        print i i A print def shellSort(A, n):
    global cnt
    cnt = 0
    if n == 1:
        G = [1]
    else:
        G = []
        h = 1
        while h < n:
            G.append(h)
            h = 3*h +1
        G = G[::-1]
    m = len(G)
    print m
    print " ".join([str(i) for i in G])
    for i in range(m):
        insertionSort(A, n, G[i]) def shellSort(A, n):
    global cnt
    cnt = 0
    if n == 1:
        G = [1]
    else:
        G = []
        h = 1
        while h < n:
            G.append(h)
            h = 3*h +1
        G = G[::-1]
    m = len(G)
    print m
    print " ".join([str(i) for i in G])
    for i in range(m):
        insertionSort(A, n, G[i]) shellSort n = int(raw_input()) int(raw_input()) n A = [] [] A 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 = 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 = j-g
            cnt += 1
        A[j+g] = v insertionSort
# coding: utf-8
# Shell Sort 2018/3/15

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

def shellSort(A, n):
    global cnt
    cnt = 0
    if n == 1:
        G = [1]
    else:
        G = []
        h = 1
        while h < n:
            G.append(h)
            h = 3*h +1
        G = G[::-1]
    m = len(G)
    print m
    print " ".join([str(i) for i in G])
    for i in range(m):
        insertionSort(A, n, G[i])

if __name__ == "__main__":
    n = int(raw_input())
    A = []
    for i in range(n):
        A.append(int(raw_input()))
    shellSort(A, n)
    print cnt
    for i in A:
        print i

