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 shellSort(A, n, m, G):
	cnt = 0
	for i in range(m):
		cnt = insertionSort(A, n, G[i], cnt)
	return cnt

n = int(input())
A = []
for i in range(n):
	A.append(int(input()))

h = 1
p = 1
G = []

if n < 2:
	G = [1]
	p = 2
else:
	while h < n: 
		G.append(h)
		h = 3 ** p + h
		p += 1

G.reverse()
cnt = shellSort(A, n, p - 1, G)
print(p - 1)
print(" ".join(map(str, G)))
print(cnt)
for i in range(n):
	print(A[i]) 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 def shellSort(A, n, m, G):
	cnt = 0
	for i in range(m):
		cnt = insertionSort(A, n, G[i], cnt)
	return cnt shellSort cnt = 0 cnt 0 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 return cnt cnt A A n n m m G G n = int(input()) n int(input()) int input() input A = [] A [] for i in range(n):
	A.append(int(input())) i range(n) range n A.append(int(input())) A.append A append int(input()) int input() input h = 1 h 1 p = 1 p 1 G = [] G [] if n < 2:
	G = [1]
	p = 2
else:
	while h < n: 
		G.append(h)
		h = 3 ** p + h
		p += 1 n < 2 n 2 G = [1] G [1] 1 p = 2 p 2 while h < n: 
		G.append(h)
		h = 3 ** p + h
		p += 1 h < n h n G.append(h) G.append G append h h = 3 ** p + h h 3 ** p + h 3 ** p 3 p h p += 1 p 1 G.reverse() G.reverse G reverse cnt = shellSort(A, n, p - 1, G) cnt shellSort(A, n, p - 1, G) shellSort A n p - 1 p 1 G print(p - 1) print p - 1 p 1 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(A[i]) i range(n) range n print(A[i]) print A[i] A i cnt = shellSort(A, n, p - 1, G) shellSort(A, n, p - 1, G) cnt n = int(input()) int(input()) n def shellSort(A, n, m, G):
	cnt = 0
	for i in range(m):
		cnt = insertionSort(A, n, G[i], cnt)
	return cnt def shellSort(A, n, m, G):
	cnt = 0
	for i in range(m):
		cnt = insertionSort(A, n, G[i], cnt)
	return cnt shellSort h = 1 1 h G = [] [] G p = 2 2 p p = 1 1 p p += 1 1 p G = [1] [1] G h = 3 ** p + h 3 ** p + h h 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 A = [] [] A
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 shellSort(A, n, m, G):
	cnt = 0
	for i in range(m):
		cnt = insertionSort(A, n, G[i], cnt)
	return cnt

n = int(input())
A = []
for i in range(n):
	A.append(int(input()))

h = 1
p = 1
G = []

if n < 2:
	G = [1]
	p = 2
else:
	while h < n: 
		G.append(h)
		h = 3 ** p + h
		p += 1

G.reverse()
cnt = shellSort(A, n, p - 1, G)
print(p - 1)
print(" ".join(map(str, G)))
print(cnt)
for i in range(n):
	print(A[i])
