import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()
A = [0] * N
for i in range(N):
    a = I()
    A[i] = a
cnt = 0

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):
    cnt = 0
    G = [1]
    j = 0
    while G[j] <= N:
        G.append(3 * G[j] + 1)
        j += 1
    m = len(G) - 1
    E = []
    for i in range(1, len(G)):
        E.append(G[len(G) - 1 - i])
    for i in range(len(G) - 1):
        insertionSort(A, n, E[i])
    print(m)
    print(' '.join(map(str, E)))


shellSort(A, N)

print(cnt)
for i in range(N):
    print(A[i])
 import bisect, collections, copy, heapq, itertools, math, string bisect collections copy heapq itertools math string import sys sys def I(): return int(sys.stdin.readline().rstrip()) I def MI(): return map(int, sys.stdin.readline().rstrip().split()) MI def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) LI def S(): return sys.stdin.readline().rstrip() S def LS(): return list(sys.stdin.readline().rstrip().split()) LS N = I() N I() I A = [0] * N A [0] * N [0] 0 N for i in range(N):
    a = I()
    A[i] = a i range(N) range N a = I() a I() I A[i] = a A[i] A i a cnt = 0 cnt 0 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):
    cnt = 0
    G = [1]
    j = 0
    while G[j] <= N:
        G.append(3 * G[j] + 1)
        j += 1
    m = len(G) - 1
    E = []
    for i in range(1, len(G)):
        E.append(G[len(G) - 1 - i])
    for i in range(len(G) - 1):
        insertionSort(A, n, E[i])
    print(m)
    print(' '.join(map(str, E))) shellSort cnt = 0 cnt 0 G = [1] G [1] 1 j = 0 j 0 while G[j] <= N:
        G.append(3 * G[j] + 1)
        j += 1
     G[j] <= N G[j] G j N G.append(3 * G[j] + 1) G.append G append 3 * G[j] + 1 3 * G[j] 3 G[j] G j 1 j += 1 j 1 m = len(G) - 1 m len(G) - 1 len(G) len G 1 E = [] E [] for i in range(1, len(G)):
        E.append(G[len(G) - 1 - i])
     i range(1, len(G)) range 1 len(G) len G E.append(G[len(G) - 1 - i]) E.append E append G[len(G) - 1 - i] G len(G) - 1 - i len(G) - 1 len(G) len G 1 i for i in range(len(G) - 1):
        insertionSort(A, n, E[i])
     i range(len(G) - 1) range len(G) - 1 len(G) len G 1 insertionSort(A, n, E[i]) insertionSort A n E[i] E i print(m) print m print(' '.join(map(str, E))) print ' '.join(map(str, E)) ' '.join ' ' join map(str, E) map str E A A n n shellSort(A, N) shellSort A N print(cnt) print cnt for i in range(N):
    print(A[i]) i range(N) range N print(A[i]) print A[i] A i A = [0] * N [0] * N 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 def shellSort(A, n):
    cnt = 0
    G = [1]
    j = 0
    while G[j] <= N:
        G.append(3 * G[j] + 1)
        j += 1
    m = len(G) - 1
    E = []
    for i in range(1, len(G)):
        E.append(G[len(G) - 1 - i])
    for i in range(len(G) - 1):
        insertionSort(A, n, E[i])
    print(m)
    print(' '.join(map(str, E))) def shellSort(A, n):
    cnt = 0
    G = [1]
    j = 0
    while G[j] <= N:
        G.append(3 * G[j] + 1)
        j += 1
    m = len(G) - 1
    E = []
    for i in range(1, len(G)):
        E.append(G[len(G) - 1 - i])
    for i in range(len(G) - 1):
        insertionSort(A, n, E[i])
    print(m)
    print(' '.join(map(str, E))) shellSort cnt = 0 0 cnt def MI(): return map(int, sys.stdin.readline().rstrip().split()) def MI(): return map(int, sys.stdin.readline().rstrip().split()) MI a = I() I() a def I(): return int(sys.stdin.readline().rstrip()) def I(): return int(sys.stdin.readline().rstrip()) I N = I() I() N def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) LI def S(): return sys.stdin.readline().rstrip() def S(): return sys.stdin.readline().rstrip() S def LS(): return list(sys.stdin.readline().rstrip().split()) def LS(): return list(sys.stdin.readline().rstrip().split()) LS
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()
A = [0] * N
for i in range(N):
    a = I()
    A[i] = a
cnt = 0

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):
    cnt = 0
    G = [1]
    j = 0
    while G[j] <= N:
        G.append(3 * G[j] + 1)
        j += 1
    m = len(G) - 1
    E = []
    for i in range(1, len(G)):
        E.append(G[len(G) - 1 - i])
    for i in range(len(G) - 1):
        insertionSort(A, n, E[i])
    print(m)
    print(' '.join(map(str, E)))


shellSort(A, N)

print(cnt)
for i in range(N):
    print(A[i])

