import math

def solution(count,nums,g,oppai):
    for i in range(g,count):
        objNum = nums[i]
        j = i - g
        while j >= 0 and nums[j] > objNum:
            nums[j+g] = nums[j]
            j -= g
            oppai.append(1)
        nums[j+g] = objNum

def shellSort(nums,count):
    oppai = []
    b = 701
    G = [x for x in [1,4,10,23,57,132,301,701] if x <= count]
    while True:
        b = math.floor(2.25*b)
        if b > n:
            break
        G.append(b)
    G = G[::-1]
    print(len(G))
    print(' '.join(map(str,G)))
    for i in range(len(G)):
        solution(count,nums,G[i],oppai)
    print(len(oppai))
    for ele in nums:
        print(ele)

n = int(input())
nums = []


for _ in range(n):
    nums.append(int(input()))
shellSort(nums,n)
 import math math def solution(count,nums,g,oppai):
    for i in range(g,count):
        objNum = nums[i]
        j = i - g
        while j >= 0 and nums[j] > objNum:
            nums[j+g] = nums[j]
            j -= g
            oppai.append(1)
        nums[j+g] = objNum solution for i in range(g,count):
        objNum = nums[i]
        j = i - g
        while j >= 0 and nums[j] > objNum:
            nums[j+g] = nums[j]
            j -= g
            oppai.append(1)
        nums[j+g] = objNum i range(g,count) range g count objNum = nums[i] objNum nums[i] nums i j = i - g j i - g i g while j >= 0 and nums[j] > objNum:
            nums[j+g] = nums[j]
            j -= g
            oppai.append(1)
         j >= 0 and nums[j] > objNum j >= 0 j 0 nums[j] > objNum nums[j] nums j objNum nums[j+g] = nums[j] nums[j+g] nums j+g j g nums[j] nums j j -= g j g oppai.append(1) oppai.append oppai append 1 nums[j+g] = objNum nums[j+g] nums j+g j g objNum count count nums nums g g oppai oppai def shellSort(nums,count):
    oppai = []
    b = 701
    G = [x for x in [1,4,10,23,57,132,301,701] if x <= count]
    while True:
        b = math.floor(2.25*b)
        if b > n:
            break
        G.append(b)
    G = G[::-1]
    print(len(G))
    print(' '.join(map(str,G)))
    for i in range(len(G)):
        solution(count,nums,G[i],oppai)
    print(len(oppai))
    for ele in nums:
        print(ele) shellSort oppai = [] oppai [] b = 701 b 701 x for x in [1,4,10,23,57,132,301,701] if x <= count for x in [1,4,10,23,57,132,301,701] if x <= count x [1,4,10,23,57,132,301,701] 1 4 10 23 57 132 301 701 x <= count x count if x <= count x G = [x for x in [1,4,10,23,57,132,301,701] if x <= count] G [x for x in [1,4,10,23,57,132,301,701] if x <= count] while True:
        b = math.floor(2.25*b)
        if b > n:
            break
        G.append(b)
     True b = math.floor(2.25*b) b math.floor(2.25*b) math.floor math floor 2.25*b 2.25 b if b > n:
            break
         b > n b n break G.append(b) G.append G append b G = G[::-1] G G[::-1] G ::-1 -1 print(len(G)) print len(G) len G print(' '.join(map(str,G))) print ' '.join(map(str,G)) ' '.join ' ' join map(str,G) map str G for i in range(len(G)):
        solution(count,nums,G[i],oppai)
     i range(len(G)) range len(G) len G solution(count,nums,G[i],oppai) solution count nums G[i] G i oppai print(len(oppai)) print len(oppai) len oppai for ele in nums:
        print(ele) ele nums print(ele) print ele nums nums count count n = int(input()) n int(input()) int input() input nums = [] nums [] for _ in range(n):
    nums.append(int(input())) _ range(n) range n nums.append(int(input())) nums.append nums append int(input()) int input() input shellSort(nums,n) shellSort nums n n = int(input()) int(input()) n def solution(count,nums,g,oppai):
    for i in range(g,count):
        objNum = nums[i]
        j = i - g
        while j >= 0 and nums[j] > objNum:
            nums[j+g] = nums[j]
            j -= g
            oppai.append(1)
        nums[j+g] = objNum def solution(count,nums,g,oppai):
    for i in range(g,count):
        objNum = nums[i]
        j = i - g
        while j >= 0 and nums[j] > objNum:
            nums[j+g] = nums[j]
            j -= g
            oppai.append(1)
        nums[j+g] = objNum solution def shellSort(nums,count):
    oppai = []
    b = 701
    G = [x for x in [1,4,10,23,57,132,301,701] if x <= count]
    while True:
        b = math.floor(2.25*b)
        if b > n:
            break
        G.append(b)
    G = G[::-1]
    print(len(G))
    print(' '.join(map(str,G)))
    for i in range(len(G)):
        solution(count,nums,G[i],oppai)
    print(len(oppai))
    for ele in nums:
        print(ele) def shellSort(nums,count):
    oppai = []
    b = 701
    G = [x for x in [1,4,10,23,57,132,301,701] if x <= count]
    while True:
        b = math.floor(2.25*b)
        if b > n:
            break
        G.append(b)
    G = G[::-1]
    print(len(G))
    print(' '.join(map(str,G)))
    for i in range(len(G)):
        solution(count,nums,G[i],oppai)
    print(len(oppai))
    for ele in nums:
        print(ele) shellSort nums = [] [] nums
import math

def solution(count,nums,g,oppai):
    for i in range(g,count):
        objNum = nums[i]
        j = i - g
        while j >= 0 and nums[j] > objNum:
            nums[j+g] = nums[j]
            j -= g
            oppai.append(1)
        nums[j+g] = objNum

def shellSort(nums,count):
    oppai = []
    b = 701
    G = [x for x in [1,4,10,23,57,132,301,701] if x <= count]
    while True:
        b = math.floor(2.25*b)
        if b > n:
            break
        G.append(b)
    G = G[::-1]
    print(len(G))
    print(' '.join(map(str,G)))
    for i in range(len(G)):
        solution(count,nums,G[i],oppai)
    print(len(oppai))
    for ele in nums:
        print(ele)

n = int(input())
nums = []


for _ in range(n):
    nums.append(int(input()))
shellSort(nums,n)

