n = int(input())
arr = [int(input()) for index in range(n)]

cnt, m = 0, 0
G = []


def insertion_sort(nums, n, g):
    global cnt
    for idx1 in range(g, n):
        v = nums[idx1]
        idx2 = idx1 - g
        while idx2 >= 0 and nums[idx2] > v:
            nums[idx2+g] = nums[idx2]
            idx2 -= g
            cnt  += 1
        nums[idx2+g] = v

h = 1
while not h > n:
    G.append(h)
    h = 3 * h + 1

m = len(G)
G.reverse()

for index in range(m):
    insertion_sort(arr, n, G[index])


print(m)
print(" ".join(map(str, G)))
print(cnt)
for i in range(n):
	print(arr[i]) n = int(input()) n int(input()) int input() input int(input()) for index in range(n) for index in range(n) index range(n) range n for index in range(n) int(input()) int input() input arr = [int(input()) for index in range(n)] arr [int(input()) for index in range(n)] cnt, m = 0, 0 cnt 0 m 0 G = [] G [] def insertion_sort(nums, n, g):
    global cnt
    for idx1 in range(g, n):
        v = nums[idx1]
        idx2 = idx1 - g
        while idx2 >= 0 and nums[idx2] > v:
            nums[idx2+g] = nums[idx2]
            idx2 -= g
            cnt  += 1
        nums[idx2+g] = v insertion_sort global cnt for idx1 in range(g, n):
        v = nums[idx1]
        idx2 = idx1 - g
        while idx2 >= 0 and nums[idx2] > v:
            nums[idx2+g] = nums[idx2]
            idx2 -= g
            cnt  += 1
        nums[idx2+g] = v idx1 range(g, n) range g n v = nums[idx1] v nums[idx1] nums idx1 idx2 = idx1 - g idx2 idx1 - g idx1 g while idx2 >= 0 and nums[idx2] > v:
            nums[idx2+g] = nums[idx2]
            idx2 -= g
            cnt  += 1
         idx2 >= 0 and nums[idx2] > v idx2 >= 0 idx2 0 nums[idx2] > v nums[idx2] nums idx2 v nums[idx2+g] = nums[idx2] nums[idx2+g] nums idx2+g idx2 g nums[idx2] nums idx2 idx2 -= g idx2 g cnt  += 1 cnt 1 nums[idx2+g] = v nums[idx2+g] nums idx2+g idx2 g v nums nums n n g g h = 1 h 1 while not h > n:
    G.append(h)
    h = 3 * h + 1 not h > n h > n h n G.append(h) G.append G append h h = 3 * h + 1 h 3 * h + 1 3 * h 3 h 1 m = len(G) m len(G) len G G.reverse() G.reverse G reverse for index in range(m):
    insertion_sort(arr, n, G[index]) index range(m) range m insertion_sort(arr, n, G[index]) insertion_sort arr n G[index] G index print(m) print m print(" ".join(map(str, G))) print " ".join(map(str, G)) " ".join " " join map(str, G) map str G print(cnt) print cnt for i in range(n):
	print(arr[i]) i range(n) range n print(arr[i]) print arr[i] arr i h = 3 * h + 1 3 * h + 1 h m = 0, 0 0 m cnt, m = 0, 0 0 cnt m = len(G) len(G) m def insertion_sort(nums, n, g):
    global cnt
    for idx1 in range(g, n):
        v = nums[idx1]
        idx2 = idx1 - g
        while idx2 >= 0 and nums[idx2] > v:
            nums[idx2+g] = nums[idx2]
            idx2 -= g
            cnt  += 1
        nums[idx2+g] = v def insertion_sort(nums, n, g):
    global cnt
    for idx1 in range(g, n):
        v = nums[idx1]
        idx2 = idx1 - g
        while idx2 >= 0 and nums[idx2] > v:
            nums[idx2+g] = nums[idx2]
            idx2 -= g
            cnt  += 1
        nums[idx2+g] = v insertion_sort arr = [int(input()) for index in range(n)] [int(input()) for index in range(n)] arr h = 1 1 h n = int(input()) int(input()) n G = [] [] G
n = int(input())
arr = [int(input()) for index in range(n)]

cnt, m = 0, 0
G = []


def insertion_sort(nums, n, g):
    global cnt
    for idx1 in range(g, n):
        v = nums[idx1]
        idx2 = idx1 - g
        while idx2 >= 0 and nums[idx2] > v:
            nums[idx2+g] = nums[idx2]
            idx2 -= g
            cnt  += 1
        nums[idx2+g] = v

h = 1
while not h > n:
    G.append(h)
    h = 3 * h + 1

m = len(G)
G.reverse()

for index in range(m):
    insertion_sort(arr, n, G[index])


print(m)
print(" ".join(map(str, G)))
print(cnt)
for i in range(n):
	print(arr[i])
