def insertionSort( nums, n, g ):
	cnt = 0
	for i in range( g, len( nums ) ):
	    v = nums[i]
	    j = i - g
	    while 0 <= j and v < nums[j]:
	        nums[ j+g ] = nums[j]
	        j -= g
	        cnt += 1
	    nums[ j+g ] = v
	
	return cnt


def shellSort( nums, n ):
	cnt = 0
	g = []
	val =0
	for i in range( 0, n ):
		val = 3*val+1
		if  n < val:
			break
		g.append( val )

	g.reverse( )
	m = len( g )
	print( m )
	print( " ".join( map( str, g ) ) )
	for i in range( 0, m ):
		cnt += insertionSort( nums, n, g[i] )
	print( cnt )

n = int( raw_input( ) )
nums = []
for i in range( 0, n ):
	nums.append( int( raw_input( ) ) )

shellSort( nums, n )
for i in nums:
	print( i ) def insertionSort( nums, n, g ):
	cnt = 0
	for i in range( g, len( nums ) ):
	    v = nums[i]
	    j = i - g
	    while 0 <= j and v < nums[j]:
	        nums[ j+g ] = nums[j]
	        j -= g
	        cnt += 1
	    nums[ j+g ] = v
	
	return cnt insertionSort cnt = 0 cnt 0 for i in range( g, len( nums ) ):
	    v = nums[i]
	    j = i - g
	    while 0 <= j and v < nums[j]:
	        nums[ j+g ] = nums[j]
	        j -= g
	        cnt += 1
	    nums[ j+g ] = v
	
	 i range( g, len( nums ) ) range g len( nums ) len nums v = nums[i] v nums[i] nums i j = i - g j i - g i g while 0 <= j and v < nums[j]:
	        nums[ j+g ] = nums[j]
	        j -= g
	        cnt += 1
	     0 <= j and v < nums[j] 0 <= j 0 j v < nums[j] v nums[j] nums j nums[ j+g ] = nums[j] nums[ j+g ] nums j+g j g nums[j] nums j j -= g j g cnt += 1 cnt 1 nums[ j+g ] = v nums[ j+g ] nums j+g j g v return cnt cnt nums nums n n g g def shellSort( nums, n ):
	cnt = 0
	g = []
	val =0
	for i in range( 0, n ):
		val = 3*val+1
		if  n < val:
			break
		g.append( val )

	g.reverse( )
	m = len( g )
	print( m )
	print( " ".join( map( str, g ) ) )
	for i in range( 0, m ):
		cnt += insertionSort( nums, n, g[i] )
	print( cnt ) shellSort cnt = 0 cnt 0 g = [] g [] val =0 val 0 for i in range( 0, n ):
		val = 3*val+1
		if  n < val:
			break
		g.append( val )

	 i range( 0, n ) range 0 n val = 3*val+1 val 3*val+1 3*val 3 val 1 if  n < val:
			break
		 n < val n val break g.append( val ) g.append g append val 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( 0, m ):
		cnt += insertionSort( nums, n, g[i] )
	 i range( 0, m ) range 0 m cnt += insertionSort( nums, n, g[i] ) cnt insertionSort( nums, n, g[i] ) insertionSort nums n g[i] g i print( cnt ) print cnt nums nums n n n = int( raw_input( ) ) n int( raw_input( ) ) int raw_input( ) raw_input nums = [] nums [] for i in range( 0, n ):
	nums.append( int( raw_input( ) ) ) i range( 0, n ) range 0 n nums.append( int( raw_input( ) ) ) nums.append nums append int( raw_input( ) ) int raw_input( ) raw_input shellSort( nums, n ) shellSort nums n for i in nums:
	print( i ) i nums print( i ) print i n = int( raw_input( ) ) int( raw_input( ) ) n def insertionSort( nums, n, g ):
	cnt = 0
	for i in range( g, len( nums ) ):
	    v = nums[i]
	    j = i - g
	    while 0 <= j and v < nums[j]:
	        nums[ j+g ] = nums[j]
	        j -= g
	        cnt += 1
	    nums[ j+g ] = v
	
	return cnt def insertionSort( nums, n, g ):
	cnt = 0
	for i in range( g, len( nums ) ):
	    v = nums[i]
	    j = i - g
	    while 0 <= j and v < nums[j]:
	        nums[ j+g ] = nums[j]
	        j -= g
	        cnt += 1
	    nums[ j+g ] = v
	
	return cnt insertionSort def shellSort( nums, n ):
	cnt = 0
	g = []
	val =0
	for i in range( 0, n ):
		val = 3*val+1
		if  n < val:
			break
		g.append( val )

	g.reverse( )
	m = len( g )
	print( m )
	print( " ".join( map( str, g ) ) )
	for i in range( 0, m ):
		cnt += insertionSort( nums, n, g[i] )
	print( cnt ) def shellSort( nums, n ):
	cnt = 0
	g = []
	val =0
	for i in range( 0, n ):
		val = 3*val+1
		if  n < val:
			break
		g.append( val )

	g.reverse( )
	m = len( g )
	print( m )
	print( " ".join( map( str, g ) ) )
	for i in range( 0, m ):
		cnt += insertionSort( nums, n, g[i] )
	print( cnt ) shellSort nums = [] [] nums
def insertionSort( nums, n, g ):
	cnt = 0
	for i in range( g, len( nums ) ):
	    v = nums[i]
	    j = i - g
	    while 0 <= j and v < nums[j]:
	        nums[ j+g ] = nums[j]
	        j -= g
	        cnt += 1
	    nums[ j+g ] = v
	
	return cnt


def shellSort( nums, n ):
	cnt = 0
	g = []
	val =0
	for i in range( 0, n ):
		val = 3*val+1
		if  n < val:
			break
		g.append( val )

	g.reverse( )
	m = len( g )
	print( m )
	print( " ".join( map( str, g ) ) )
	for i in range( 0, m ):
		cnt += insertionSort( nums, n, g[i] )
	print( cnt )

n = int( raw_input( ) )
nums = []
for i in range( 0, n ):
	nums.append( int( raw_input( ) ) )

shellSort( nums, n )
for i in nums:
	print( i )