Shell Sort is a generalization of [Insertion Sort](http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_A) to arrange a list of $n$ elements $A$.                 1  insertionSort(A, n, g) 2      for i = g to n-1 3          v = A[i] 4          j = i - g 5          while j >= 0 && A[j] > v 6              A[j+g] = A[j] 7              j = j - g 8              cnt++ 9          A[j+g] = v 10 11 shellSort(A, n) 12     cnt = 0 13     m = ? 14     G[] = {?, ?,..., ?} 15     for i = 0 to m-1 16         insertionSort(A, n, G[i])   A function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.  Your task is to complete the above program by filling ?. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:    * $1 \leq m \leq 100$   * $0 \leq G_i \leq n$   * cnt does not exceed $\lceil n^{1.5}\rceil$
def insetion_sort(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


def shell_sort(A, n) :
        cnt = 0
        m = 8
        G = [1, 4, 40, 121, 364, 1093, 3280, 9841]
        for i in range(m) :
                insetion_sort(A, n, G[i], cnt)
        print(cnt)


def main() :
        n = int(input())
        nums = []
        for i in range(n) :
                nums.append(int(input()))

        print("8")
        print("9841  3280 1093 364 121 40 4 1")
        shell_sort(nums, n)
        for i in range(n) :
                print(nums[i])

if __name__ == '__main__' :
        main()
def insetion_sort(A, n, g, cnt) :
        cnt = 0
        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 shell_sort(A, n) :
        cnt = 0
        count = 0
        G_sub = []
        h = 1
        while h <= n :
                G_sub.append(h)
                h = 3 * h + 1
        m = len(G_sub)
        G = G_sub[::-1]

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

        print(m)
        if len(G) == 1 :
                print(G[0])
        else :
                print(" ".join(map(str, G)))
        print(count)


def main() :
        n = int(input())
        nums = []
        for i in range(n) :
                nums.append(int(input()))

        shell_sort(nums, n)
        for i in range(n) :
                print(nums[i])

if __name__ == '__main__' :
        main()