cnt = 0
n = int(raw_input())
A = [int(raw_input()) for _ in range(n)]
G = [1] if n < 5 else [1, 4]
while G[-1]*3+1 <= n/3: G.append(G[-1]*3+1)
if n > 256: G.append(n/10*9)
G.reverse()

def insersionSort(g):
	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 = j - g
			cnt += 1
		A[j+g] = v

def shellSort():
	for g in G:
		insersionSort(g)

shellSort()
print len(G)
print " ".join(map(str, G))
print cnt
print "\n".join(map(str, A)) cnt = 0 cnt 0 n = int(raw_input()) n int(raw_input()) int raw_input() raw_input int(raw_input()) for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) int(raw_input()) int raw_input() raw_input A = [int(raw_input()) for _ in range(n)] A [int(raw_input()) for _ in range(n)] G = [1] if n < 5 else [1, 4] G [1] if n < 5 else [1, 4] n < 5 n 5 [1] 1 [1, 4] 1 4 while G[-1]*3+1 <= n/3: G.append(G[-1]*3+1) G[-1]*3+1 <= n/3 G[-1]*3+1 G[-1]*3 G[-1] G -1 3 1 n/3 n 3 if n > 256: G.append(n/10*9) n > 256 n 256 G.reverse() G.reverse G reverse def insersionSort(g):
	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 = j - g
			cnt += 1
		A[j+g] = v insersionSort 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 = 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 g g def shellSort():
	for g in G:
		insersionSort(g) shellSort for g in G:
		insersionSort(g) g G insersionSort(g) insersionSort g shellSort() shellSort print len(G) len G print " ".join(map(str, G)) " ".join " " join map(str, G) map str G print print "\n".join(map(str, A)) "\n".join "\n" join map(str, A) map str A def shellSort():
	for g in G:
		insersionSort(g) def shellSort():
	for g in G:
		insersionSort(g) shellSort G = [1] if n < 5 else [1, 4] [1] if n < 5 else [1, 4] G A = [int(raw_input()) for _ in range(n)] [int(raw_input()) for _ in range(n)] A def insersionSort(g):
	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 = j - g
			cnt += 1
		A[j+g] = v def insersionSort(g):
	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 = j - g
			cnt += 1
		A[j+g] = v insersionSort n = int(raw_input()) int(raw_input()) n cnt = 0 0 cnt
cnt = 0
n = int(raw_input())
A = [int(raw_input()) for _ in range(n)]
G = [1] if n < 5 else [1, 4]
while G[-1]*3+1 <= n/3: G.append(G[-1]*3+1)
if n > 256: G.append(n/10*9)
G.reverse()

def insersionSort(g):
	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 = j - g
			cnt += 1
		A[j+g] = v

def shellSort():
	for g in G:
		insersionSort(g)

shellSort()
print len(G)
print " ".join(map(str, G))
print cnt
print "\n".join(map(str, A))