
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

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

cnt = 0

G = [1]
while G[-1] * 3 + 1 < n:
	G.append(G[-1] * 3 + 1)
G.reverse()
m = len(G)
for i in range(m):
	cnt = insertionsort(A, n, G[i], cnt)

print m
print " ".join(map(str, G))
print cnt
for num in A:
	print num 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 A = [] A [] n = int(raw_input()) n int(raw_input()) int raw_input() raw_input for i in range(n):
	A.append(int(raw_input())) i range(n) range n A.append(int(raw_input())) A.append A append int(raw_input()) int raw_input() raw_input cnt = 0 cnt 0 G = [1] G [1] 1 while G[-1] * 3 + 1 < n:
	G.append(G[-1] * 3 + 1) G[-1] * 3 + 1 < n G[-1] * 3 + 1 G[-1] * 3 G[-1] G -1 3 1 n G.append(G[-1] * 3 + 1) G.append G append G[-1] * 3 + 1 G[-1] * 3 G[-1] G -1 3 1 G.reverse() G.reverse G reverse m = len(G) m len(G) len G 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 print print " ".join(map(str, G)) " ".join " " join map(str, G) map str G print for num in A:
	print num num A print m = len(G) len(G) m A = [] [] A n = int(raw_input()) int(raw_input()) n 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 G = [1] [1] G cnt = 0 0 cnt cnt = insertionsort(A, n, G[i], cnt) insertionsort(A, n, G[i], cnt) 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

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

cnt = 0

G = [1]
while G[-1] * 3 + 1 < n:
	G.append(G[-1] * 3 + 1)
G.reverse()
m = len(G)
for i in range(m):
	cnt = insertionsort(A, n, G[i], cnt)

print m
print " ".join(map(str, G))
print cnt
for num in A:
	print num