# -*- coding: utf-8 -*-
"""
Created on Sun Jun 18 10:42:00 2017

@author: syaga
"""

import math

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 = 0
    G = [1]
    if n != 1:
        for i in range(99):
            G.append(G[i]*3+1)
        G = [x for x in G if x < n]
        G.reverse()
    m = len(G)
    print(m)
    print(" ".join(map(str, G)))
    for i in range(0, m):
        cnt = insertionSort(A, n, G[i], cnt)
    print(cnt)

if __name__ == "__main__":
    n = int(input())
    A = []
    for i in range(n):
        A.append(int(input()))
    shellSort(A, n)
    for i in A:
        print(i) """
Created on Sun Jun 18 10:42:00 2017

@author: syaga
""" import math math 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 = 0
    G = [1]
    if n != 1:
        for i in range(99):
            G.append(G[i]*3+1)
        G = [x for x in G if x < n]
        G.reverse()
    m = len(G)
    print(m)
    print(" ".join(map(str, G)))
    for i in range(0, m):
        cnt = insertionSort(A, n, G[i], cnt)
    print(cnt) shellSort cnt = 0 cnt 0 G = [1] G [1] 1 if n != 1:
        for i in range(99):
            G.append(G[i]*3+1)
        G = [x for x in G if x < n]
        G.reverse()
     n != 1 n 1 for i in range(99):
            G.append(G[i]*3+1)
         i range(99) range 99 G.append(G[i]*3+1) G.append G append G[i]*3+1 G[i]*3 G[i] G i 3 1 x for x in G if x < n for x in G if x < n x G x < n x n if x < n x G = [x for x in G if x < n] G [x for x in G if x < n] G.reverse() G.reverse G reverse m = len(G) m len(G) len G print(m) print m print(" ".join(map(str, G))) print " ".join(map(str, G)) " ".join " " join map(str, G) map str G for i in range(0, m):
        cnt = insertionSort(A, n, G[i], cnt)
     i range(0, m) range 0 m cnt = insertionSort(A, n, G[i], cnt) cnt insertionSort(A, n, G[i], cnt) insertionSort A n G[i] G i cnt print(cnt) print cnt A A n n if __name__ == "__main__":
    n = int(input())
    A = []
    for i in range(n):
        A.append(int(input()))
    shellSort(A, n)
    for i in A:
        print(i) __name__ == "__main__" __name__ "__main__" n = int(input()) n int(input()) int input() input A = [] A [] for i in range(n):
        A.append(int(input()))
     i range(n) range n A.append(int(input())) A.append A append int(input()) int input() input shellSort(A, n) shellSort A n for i in A:
        print(i) i A print(i) print i def shellSort(A, n):
    cnt = 0
    G = [1]
    if n != 1:
        for i in range(99):
            G.append(G[i]*3+1)
        G = [x for x in G if x < n]
        G.reverse()
    m = len(G)
    print(m)
    print(" ".join(map(str, G)))
    for i in range(0, m):
        cnt = insertionSort(A, n, G[i], cnt)
    print(cnt) def shellSort(A, n):
    cnt = 0
    G = [1]
    if n != 1:
        for i in range(99):
            G.append(G[i]*3+1)
        G = [x for x in G if x < n]
        G.reverse()
    m = len(G)
    print(m)
    print(" ".join(map(str, G)))
    for i in range(0, m):
        cnt = insertionSort(A, n, G[i], cnt)
    print(cnt) 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 n = int(input()) int(input()) n A = [] [] A
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 18 10:42:00 2017

@author: syaga
"""

import math

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 = 0
    G = [1]
    if n != 1:
        for i in range(99):
            G.append(G[i]*3+1)
        G = [x for x in G if x < n]
        G.reverse()
    m = len(G)
    print(m)
    print(" ".join(map(str, G)))
    for i in range(0, m):
        cnt = insertionSort(A, n, G[i], cnt)
    print(cnt)

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