n = int(input())
A = [int(input()) for _ in range(n)]

# 間隔gを指定した挿入ソート
def insertSort(A, g):
	n = len(A)
	global 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 -= g
			cnt += 1
		A[j + g] = v
	return 0

def shellSort(A):
	n = len(A)
	G = []
	# G = {1, 4, 13, 40, 121, 364,...}
	h = 1
	while h <= n:
		G.append(h)
		h = 3 * h + 1
	for i in range(len(G) - 1, -1, -1):
		insertSort(A, G[i])
	return G

cnt = 0
G = shellSort(A)
print(len(G))
print(*G[::-1])
print(cnt)
for v in A: print(v) n = int(input()) n int(input()) int input() input int(input()) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) int(input()) int input() input A = [int(input()) for _ in range(n)] A [int(input()) for _ in range(n)] def insertSort(A, g):
	n = len(A)
	global 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 -= g
			cnt += 1
		A[j + g] = v
	return 0 insertSort n = len(A) n len(A) len A global 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 -= 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 -= 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 -= g j g cnt += 1 cnt 1 A[j + g] = v A[j + g] A j + g j g v return 0 0 A A g g def shellSort(A):
	n = len(A)
	G = []
	# G = {1, 4, 13, 40, 121, 364,...}
	h = 1
	while h <= n:
		G.append(h)
		h = 3 * h + 1
	for i in range(len(G) - 1, -1, -1):
		insertSort(A, G[i])
	return G shellSort n = len(A) n len(A) len A G = [] G [] h = 1 h 1 while h <= n:
		G.append(h)
		h = 3 * h + 1
	 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 for i in range(len(G) - 1, -1, -1):
		insertSort(A, G[i])
	 i range(len(G) - 1, -1, -1) range len(G) - 1 len(G) len G 1 -1 -1 insertSort(A, G[i]) insertSort A G[i] G i return G G A A cnt = 0 cnt 0 G = shellSort(A) G shellSort(A) shellSort A print(len(G)) print len(G) len G print(*G[::-1]) print *G[::-1] G[::-1] G ::-1 -1 print(cnt) print cnt for v in A: print(v) v A def shellSort(A):
	n = len(A)
	G = []
	# G = {1, 4, 13, 40, 121, 364,...}
	h = 1
	while h <= n:
		G.append(h)
		h = 3 * h + 1
	for i in range(len(G) - 1, -1, -1):
		insertSort(A, G[i])
	return G def shellSort(A):
	n = len(A)
	G = []
	# G = {1, 4, 13, 40, 121, 364,...}
	h = 1
	while h <= n:
		G.append(h)
		h = 3 * h + 1
	for i in range(len(G) - 1, -1, -1):
		insertSort(A, G[i])
	return G shellSort G = shellSort(A) shellSort(A) G A = [int(input()) for _ in range(n)] [int(input()) for _ in range(n)] A cnt = 0 0 cnt def insertSort(A, g):
	n = len(A)
	global 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 -= g
			cnt += 1
		A[j + g] = v
	return 0 def insertSort(A, g):
	n = len(A)
	global 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 -= g
			cnt += 1
		A[j + g] = v
	return 0 insertSort n = int(input()) int(input()) n
n = int(input())
A = [int(input()) for _ in range(n)]

# 間隔gを指定した挿入ソート
def insertSort(A, g):
	n = len(A)
	global 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 -= g
			cnt += 1
		A[j + g] = v
	return 0

def shellSort(A):
	n = len(A)
	G = []
	# G = {1, 4, 13, 40, 121, 364,...}
	h = 1
	while h <= n:
		G.append(h)
		h = 3 * h + 1
	for i in range(len(G) - 1, -1, -1):
		insertSort(A, G[i])
	return G

cnt = 0
G = shellSort(A)
print(len(G))
print(*G[::-1])
print(cnt)
for v in A: print(v)
