def insertionSort(A, n , g, in_cnt):
    lo_cnt = in_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
            lo_cnt = lo_cnt + 1
        A[j+g] = v
    return [A,lo_cnt]


A = []
G = []
data_num = int(input())
for i in range(data_num):
     A.append(int(input().rstrip()))

cnt = 0
gap = data_num
while True: 
    if gap > 1:
        gap = gap // 2

    G.append(gap)
    A, cnt = insertionSort(A, data_num, gap, cnt)
    if gap == 1:
        break
    
print(str(len(G)))
print(" ".join(map(str,G)))
print(str(cnt))
print("\n".join(map(str,A))) def insertionSort(A, n , g, in_cnt):
    lo_cnt = in_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
            lo_cnt = lo_cnt + 1
        A[j+g] = v
    return [A,lo_cnt] insertionSort lo_cnt = in_cnt lo_cnt in_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
            lo_cnt = lo_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
            lo_cnt = lo_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 lo_cnt = lo_cnt + 1 lo_cnt lo_cnt + 1 lo_cnt 1 A[j+g] = v A[j+g] A j+g j g v return [A,lo_cnt] [A,lo_cnt] A lo_cnt A A n n g g in_cnt in_cnt A = [] A [] G = [] G [] data_num = int(input()) data_num int(input()) int input() input for i in range(data_num):
     A.append(int(input().rstrip())) i range(data_num) range data_num A.append(int(input().rstrip())) A.append A append int(input().rstrip()) int input().rstrip() ().rstrip () input rstrip cnt = 0 cnt 0 gap = data_num gap data_num while True: 
    if gap > 1:
        gap = gap // 2

    G.append(gap)
    A, cnt = insertionSort(A, data_num, gap, cnt)
    if gap == 1:
        break
     True if gap > 1:
        gap = gap // 2

     gap > 1 gap 1 gap = gap // 2 gap gap // 2 gap 2 G.append(gap) G.append G append gap A, cnt = insertionSort(A, data_num, gap, cnt) A insertionSort(A, data_num, gap, cnt) insertionSort A data_num gap cnt cnt if gap == 1:
        break
     gap == 1 gap 1 break print(str(len(G))) print str(len(G)) str len(G) len G print(" ".join(map(str,G))) print " ".join(map(str,G)) " ".join " " join map(str,G) map str G print(str(cnt)) print str(cnt) str cnt print("\n".join(map(str,A))) print "\n".join(map(str,A)) "\n".join "\n" join map(str,A) map str A A = [] [] A def insertionSort(A, n , g, in_cnt):
    lo_cnt = in_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
            lo_cnt = lo_cnt + 1
        A[j+g] = v
    return [A,lo_cnt] def insertionSort(A, n , g, in_cnt):
    lo_cnt = in_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
            lo_cnt = lo_cnt + 1
        A[j+g] = v
    return [A,lo_cnt] insertionSort data_num = int(input()) int(input()) data_num G = [] [] G cnt = 0 0 cnt gap = gap // 2 gap // 2 gap gap = data_num data_num gap A, cnt = insertionSort(A, data_num, gap, cnt) insertionSort(A, data_num, gap, cnt) A cnt = insertionSort(A, data_num, gap, cnt) insertionSort(A, data_num, gap, cnt) cnt
def insertionSort(A, n , g, in_cnt):
    lo_cnt = in_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
            lo_cnt = lo_cnt + 1
        A[j+g] = v
    return [A,lo_cnt]


A = []
G = []
data_num = int(input())
for i in range(data_num):
     A.append(int(input().rstrip()))

cnt = 0
gap = data_num
while True: 
    if gap > 1:
        gap = gap // 2

    G.append(gap)
    A, cnt = insertionSort(A, data_num, gap, cnt)
    if gap == 1:
        break
    
print(str(len(G)))
print(" ".join(map(str,G)))
print(str(cnt))
print("\n".join(map(str,A)))