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 A,cnt

def shellSort(A,n):
	cnt = 0
	G = [1]
	while G[-1] <= n/9:
		G.append(G[-1]*3 + 1)
	G = G[::-1]
	m = len(G)
	for g in G:
		A,cnt = insertionSort(A,n,g,cnt)
	return A,m,G,cnt

if __name__ == '__main__':
	
	n = int(input())
	A = []
	[A.append(int(input())) for i in range(n)]
	
	'''
	data = [int(d) for d in data.split('\n')]
	n = data.pop(0)
	A = data[:]
	'''
	
	A,m,G,cnt = shellSort(A,n)
	print(m)
	print(' '.join([str(i) for i in G]))
	print(cnt)
	[print(a) for a in 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 A,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 A,cnt return A,cnt A cnt A A n n g g cnt cnt def shellSort(A,n):
	cnt = 0
	G = [1]
	while G[-1] <= n/9:
		G.append(G[-1]*3 + 1)
	G = G[::-1]
	m = len(G)
	for g in G:
		A,cnt = insertionSort(A,n,g,cnt)
	return A,m,G,cnt shellSort cnt = 0 cnt 0 G = [1] G [1] 1 while G[-1] <= n/9:
		G.append(G[-1]*3 + 1)
	 G[-1] <= n/9 G[-1] G -1 n/9 n 9 G.append(G[-1]*3 + 1) G.append G append G[-1]*3 + 1 G[-1]*3 G[-1] G -1 3 1 G = G[::-1] G G[::-1] G ::-1 -1 m = len(G) m len(G) len G for g in G:
		A,cnt = insertionSort(A,n,g,cnt)
	 g G A,cnt = insertionSort(A,n,g,cnt) A insertionSort(A,n,g,cnt) insertionSort A n g cnt cnt return A,m,G,cnt return A,m,G,cnt A m G cnt A A n n if __name__ == '__main__':
	
	n = int(input())
	A = []
	[A.append(int(input())) for i in range(n)]
	
	'''
	data = [int(d) for d in data.split('\n')]
	n = data.pop(0)
	A = data[:]
	'''
	
	A,m,G,cnt = shellSort(A,n)
	print(m)
	print(' '.join([str(i) for i in G]))
	print(cnt)
	[print(a) for a in A] __name__ == '__main__' __name__ '__main__' n = int(input()) n int(input()) int input() input A = [] A [] A.append(int(input())) for i in range(n) for i in range(n) i range(n) range n for i in range(n) A.append(int(input())) A.append A append int(input()) int input() input [A.append(int(input())) for i in range(n)] '''
	data = [int(d) for d in data.split('\n')]
	n = data.pop(0)
	A = data[:]
	''' A,m,G,cnt = shellSort(A,n) A shellSort(A,n) shellSort A n m G cnt print(m) print m str(i) for i in G for i in G i G for i in G str(i) str i print(' '.join([str(i) for i in G])) print ' '.join([str(i) for i in G]) ' '.join ' ' join [str(i) for i in G] print(cnt) print cnt print(a) for a in A for a in A a A for a in A print(a) print a [print(a) for a in A] A = [] [] A m,G,cnt = shellSort(A,n) shellSort(A,n) m def shellSort(A,n):
	cnt = 0
	G = [1]
	while G[-1] <= n/9:
		G.append(G[-1]*3 + 1)
	G = G[::-1]
	m = len(G)
	for g in G:
		A,cnt = insertionSort(A,n,g,cnt)
	return A,m,G,cnt def shellSort(A,n):
	cnt = 0
	G = [1]
	while G[-1] <= n/9:
		G.append(G[-1]*3 + 1)
	G = G[::-1]
	m = len(G)
	for g in G:
		A,cnt = insertionSort(A,n,g,cnt)
	return A,m,G,cnt shellSort cnt = shellSort(A,n) shellSort(A,n) 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 A,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 A,cnt insertionSort n = int(input()) int(input()) n G,cnt = shellSort(A,n) shellSort(A,n) G A,m,G,cnt = shellSort(A,n) shellSort(A,n) 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 A,cnt

def shellSort(A,n):
	cnt = 0
	G = [1]
	while G[-1] <= n/9:
		G.append(G[-1]*3 + 1)
	G = G[::-1]
	m = len(G)
	for g in G:
		A,cnt = insertionSort(A,n,g,cnt)
	return A,m,G,cnt

if __name__ == '__main__':
	
	n = int(input())
	A = []
	[A.append(int(input())) for i in range(n)]
	
	'''
	data = [int(d) for d in data.split('\n')]
	n = data.pop(0)
	A = data[:]
	'''
	
	A,m,G,cnt = shellSort(A,n)
	print(m)
	print(' '.join([str(i) for i in G]))
	print(cnt)
	[print(a) for a in A]