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

N = int(input())
A = [int(input()) for j in range(N)]

cnt = 0
G=[]
G.append(1)

for i in range(100):
	g = 3 * G[i] + 1
	if g >= N:
		break
	else:
		G.append(g)

G.reverse()
m = len(G)
print(m)
print(" ".join(map(str, G)))

for i in range(m):
	cnt, A = InsertionSort(A, N, G[i], cnt)

print(cnt)
Ap = [print(A[i]) for i in range(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 -= g
			cnt += 1
		A[j+g] = v
	
	return(cnt, A) 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 -= 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(cnt, A) (cnt, A) cnt A A A N N g g cnt cnt N = int(input()) N int(input()) int input() input int(input()) for j in range(N) for j in range(N) j range(N) range N for j in range(N) int(input()) int input() input A = [int(input()) for j in range(N)] A [int(input()) for j in range(N)] cnt = 0 cnt 0 G=[] G [] G.append(1) G.append G append 1 for i in range(100):
	g = 3 * G[i] + 1
	if g >= N:
		break
	else:
		G.append(g) i range(100) range 100 g = 3 * G[i] + 1 g 3 * G[i] + 1 3 * G[i] 3 G[i] G i 1 if g >= N:
		break
	else:
		G.append(g) g >= N g N break G.append(g) G.append G append g G.reverse() G.reverse G reverse m = len(G) m len(G) len G print(m) print m print(" ".join(map(str, G))) print " ".join(map(str, G)) " ".join " " join map(str, G) map str G for i in range(m):
	cnt, A = InsertionSort(A, N, G[i], cnt) i range(m) range m cnt, A = InsertionSort(A, N, G[i], cnt) cnt InsertionSort(A, N, G[i], cnt) InsertionSort A N G[i] G i cnt A print(cnt) print cnt print(A[i]) for i in range(N) for i in range(N) i range(N) range N for i in range(N) print(A[i]) print A[i] A i Ap = [print(A[i]) for i in range(N)] Ap [print(A[i]) for i in range(N)] cnt = 0 0 cnt G=[] [] G Ap = [print(A[i]) for i in range(N)] [print(A[i]) for i in range(N)] Ap A = InsertionSort(A, N, G[i], cnt) InsertionSort(A, N, G[i], cnt) A cnt, A = InsertionSort(A, N, G[i], cnt) InsertionSort(A, N, G[i], cnt) cnt g = 3 * G[i] + 1 3 * G[i] + 1 g 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 -= g
			cnt += 1
		A[j+g] = v
	
	return(cnt, 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 -= g
			cnt += 1
		A[j+g] = v
	
	return(cnt, A) InsertionSort A = [int(input()) for j in range(N)] [int(input()) for j in range(N)] A m = len(G) len(G) m N = int(input()) int(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 -= g
			cnt += 1
		A[j+g] = v
	
	return(cnt, A)

N = int(input())
A = [int(input()) for j in range(N)]

cnt = 0
G=[]
G.append(1)

for i in range(100):
	g = 3 * G[i] + 1
	if g >= N:
		break
	else:
		G.append(g)

G.reverse()
m = len(G)
print(m)
print(" ".join(map(str, G)))

for i in range(m):
	cnt, A = InsertionSort(A, N, G[i], cnt)

print(cnt)
Ap = [print(A[i]) for i in range(N)]