def insertion_sort(a, n, g):
    count = 0
    for i in range(g, n):
        j = i
        while j >= g and a[j-g] > a[j]:
                a[j-g], a[j] = a[j], a[j-g]
                j -= g
                count += 1

    return a, count


if __name__ == "__main__":
    import sys
    n = int(input())
    a = list(map(int, sys.stdin))
    count = 0

    G = [1]
    while n >= 3*G[-1] + 1:
        G.append(3*G[-1] + 1)

    for g in G[::-1]:
        a, cnt = insertion_sort(a, n, g)
        count += cnt

    print(len(G))
    print(*G[::-1])
    print(count)
    print(*a, sep="\n") def insertion_sort(a, n, g):
    count = 0
    for i in range(g, n):
        j = i
        while j >= g and a[j-g] > a[j]:
                a[j-g], a[j] = a[j], a[j-g]
                j -= g
                count += 1

    return a, count insertion_sort count = 0 count 0 for i in range(g, n):
        j = i
        while j >= g and a[j-g] > a[j]:
                a[j-g], a[j] = a[j], a[j-g]
                j -= g
                count += 1

     i range(g, n) range g n j = i j i while j >= g and a[j-g] > a[j]:
                a[j-g], a[j] = a[j], a[j-g]
                j -= g
                count += 1

     j >= g and a[j-g] > a[j] j >= g j g a[j-g] > a[j] a[j-g] a j-g j g a[j] a j 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 j -= g j g count += 1 count 1 return a, count return a, count a count a a n n g g if __name__ == "__main__":
    import sys
    n = int(input())
    a = list(map(int, sys.stdin))
    count = 0

    G = [1]
    while n >= 3*G[-1] + 1:
        G.append(3*G[-1] + 1)

    for g in G[::-1]:
        a, cnt = insertion_sort(a, n, g)
        count += cnt

    print(len(G))
    print(*G[::-1])
    print(count)
    print(*a, sep="\n") __name__ == "__main__" __name__ "__main__" import sys sys n = int(input()) n int(input()) int input() input a = list(map(int, sys.stdin)) a list(map(int, sys.stdin)) list map(int, sys.stdin) map int sys.stdin sys stdin count = 0 count 0 G = [1] G [1] 1 while n >= 3*G[-1] + 1:
        G.append(3*G[-1] + 1)

     n >= 3*G[-1] + 1 n 3*G[-1] + 1 3*G[-1] 3 G[-1] G -1 1 G.append(3*G[-1] + 1) G.append G append 3*G[-1] + 1 3*G[-1] 3 G[-1] G -1 1 for g in G[::-1]:
        a, cnt = insertion_sort(a, n, g)
        count += cnt

     g G[::-1] G ::-1 -1 a, cnt = insertion_sort(a, n, g) a insertion_sort(a, n, g) insertion_sort a n g cnt count += cnt count cnt print(len(G)) print len(G) len G print(*G[::-1]) print *G[::-1] G[::-1] G ::-1 -1 print(count) print count print(*a, sep="\n") print *a a sep="\n" sep "\n" def insertion_sort(a, n, g):
    count = 0
    for i in range(g, n):
        j = i
        while j >= g and a[j-g] > a[j]:
                a[j-g], a[j] = a[j], a[j-g]
                j -= g
                count += 1

    return a, count def insertion_sort(a, n, g):
    count = 0
    for i in range(g, n):
        j = i
        while j >= g and a[j-g] > a[j]:
                a[j-g], a[j] = a[j], a[j-g]
                j -= g
                count += 1

    return a, count insertion_sort cnt = insertion_sort(a, n, g) insertion_sort(a, n, g) cnt a = list(map(int, sys.stdin)) list(map(int, sys.stdin)) a count = 0 0 count G = [1] [1] G count += cnt cnt count a, cnt = insertion_sort(a, n, g) insertion_sort(a, n, g) a n = int(input()) int(input()) n
def insertion_sort(a, n, g):
    count = 0
    for i in range(g, n):
        j = i
        while j >= g and a[j-g] > a[j]:
                a[j-g], a[j] = a[j], a[j-g]
                j -= g
                count += 1

    return a, count


if __name__ == "__main__":
    import sys
    n = int(input())
    a = list(map(int, sys.stdin))
    count = 0

    G = [1]
    while n >= 3*G[-1] + 1:
        G.append(3*G[-1] + 1)

    for g in G[::-1]:
        a, cnt = insertion_sort(a, n, g)
        count += cnt

    print(len(G))
    print(*G[::-1])
    print(count)
    print(*a, sep="\n")
