n = int(raw_input())
a = []
for i in range(n):
    a.append(int(raw_input()))

cnt = 0
num = 1
G = [1]
while 1:
    if num*3+1 > n:
        break
    G.insert(0, num*3+1)
    num = num*3 + 1
m = len(G)

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

for i in range(m):
    cnt = insertionSort(a, n, G[i], cnt)

print m
for i in range(m):
    if i == m-1:
        print G[i]
    else:
        print G[i],
        
print cnt

for i in range(n):
    print a[i] n = int(raw_input()) n int(raw_input()) int raw_input() raw_input a = [] a [] for i in range(n):
    a.append(int(raw_input())) i range(n) range n a.append(int(raw_input())) a.append a append int(raw_input()) int raw_input() raw_input cnt = 0 cnt 0 num = 1 num 1 G = [1] G [1] 1 while 1:
    if num*3+1 > n:
        break
    G.insert(0, num*3+1)
    num = num*3 + 1 1 if num*3+1 > n:
        break
     num*3+1 > n num*3+1 num*3 num 3 1 n break G.insert(0, num*3+1) G.insert G insert 0 num*3+1 num*3 num 3 1 num = num*3 + 1 num num*3 + 1 num*3 num 3 1 m = len(G) m len(G) len G 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 for i in range(m):
    cnt = insertionSort(a, n, G[i], cnt) i range(m) range m cnt = insertionSort(a, n, G[i], cnt) cnt insertionSort(a, n, G[i], cnt) insertionSort a n G[i] G i cnt print for i in range(m):
    if i == m-1:
        print G[i]
    else:
        print G[i],
         i range(m) range m if i == m-1:
        print G[i]
    else:
        print G[i],
         i == m-1 i m-1 m 1 print G[i] G i print G[i] G i print for i in range(n):
    print a[i] i range(n) range n print a[i] a i a = [] [] a m = len(G) len(G) m num = num*3 + 1 num*3 + 1 num n = int(raw_input()) int(raw_input()) n G = [1] [1] G 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 cnt = 0 0 cnt cnt = insertionSort(a, n, G[i], cnt) insertionSort(a, n, G[i], cnt) cnt num = 1 1 num
n = int(raw_input())
a = []
for i in range(n):
    a.append(int(raw_input()))

cnt = 0
num = 1
G = [1]
while 1:
    if num*3+1 > n:
        break
    G.insert(0, num*3+1)
    num = num*3 + 1
m = len(G)

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

for i in range(m):
    cnt = insertionSort(a, n, G[i], cnt)

print m
for i in range(m):
    if i == m-1:
        print G[i]
    else:
        print G[i],
        
print cnt

for i in range(n):
    print a[i]