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):
    global cnt
    cnt = 0

    G = []
    g = 1
    while g <= N:
        G.insert(0, g)
        g = 3 * g + 1

    for g in G:
        insertionSort(A, N, g)

    print len(G)
    print " ".join(str(g) for g in G)
    print cnt
    for i in A:
        print i

if __name__ == "__main__":
    N = input()
    A = []
    for i in range(N):
        A.append(input())
    shellSort(A, N) 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):
    global cnt
    cnt = 0

    G = []
    g = 1
    while g <= N:
        G.insert(0, g)
        g = 3 * g + 1

    for g in G:
        insertionSort(A, N, g)

    print len(G)
    print " ".join(str(g) for g in G)
    print cnt
    for i in A:
        print i shellSort global cnt cnt = 0 cnt 0 G = [] G [] g = 1 g 1 while g <= N:
        G.insert(0, g)
        g = 3 * g + 1

     g <= N g N G.insert(0, g) G.insert G insert 0 g g = 3 * g + 1 g 3 * g + 1 3 * g 3 g 1 for g in G:
        insertionSort(A, N, g)

     g G insertionSort(A, N, g) insertionSort A N g print len(G) len G print " ".join(str(g) for g in G) " ".join " " join str(g) str g print for i in A:
        print i i A print A A N N if __name__ == "__main__":
    N = input()
    A = []
    for i in range(N):
        A.append(input())
    shellSort(A, N) __name__ == "__main__" __name__ "__main__" N = input() N input() input A = [] A [] for i in range(N):
        A.append(input())
     i range(N) range N A.append(input()) A.append A append input() input shellSort(A, N) shellSort A N N = input() input() N 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 A = [] [] A def shellSort(A, N):
    global cnt
    cnt = 0

    G = []
    g = 1
    while g <= N:
        G.insert(0, g)
        g = 3 * g + 1

    for g in G:
        insertionSort(A, N, g)

    print len(G)
    print " ".join(str(g) for g in G)
    print cnt
    for i in A:
        print i def shellSort(A, N):
    global cnt
    cnt = 0

    G = []
    g = 1
    while g <= N:
        G.insert(0, g)
        g = 3 * g + 1

    for g in G:
        insertionSort(A, N, g)

    print len(G)
    print " ".join(str(g) for g in G)
    print cnt
    for i in A:
        print i shellSort
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):
    global cnt
    cnt = 0

    G = []
    g = 1
    while g <= N:
        G.insert(0, g)
        g = 3 * g + 1

    for g in G:
        insertionSort(A, N, g)

    print len(G)
    print " ".join(str(g) for g in G)
    print cnt
    for i in A:
        print i

if __name__ == "__main__":
    N = input()
    A = []
    for i in range(N):
        A.append(input())
    shellSort(A, N)