human
Counting cross lines in an array | Function return count of cross line in an array.
Move elements of arr [ 0. . i - 1 ] , that are greater than key , to one position ahead of their current position.
increment cross line by one.
Driver Code"
How can the above be solved in Python?

Can you provide a code to counting cross lines in an array and the other steps required?
assistant
#Here is code to counting cross lines in an array and the other steps required.
 def countCrossLine ( arr , n ) :
	count_crossline = 0 ;
	i , key , j = 0 , 0 , 0 ;
	for i in range ( 1 , n ) :
		key = arr [ i ] ;
		j = i - 1 ;
		while ( j >= 0 and arr [ j ] > key ) :
			arr [ j + 1 ] = arr [ j ] ;
			j = j - 1 ;
			count_crossline += 1 ;
		arr [ j + 1 ] = key ;
	return count_crossline ;
if __name__ == ' _ _ main _ _ ' :
	arr = [ 4 , 3 , 1 , 2 ] ;
	n = len ( arr ) ;
	print ( countCrossLine ( arr , n ) ) ;