human
Make array elements equal with minimum cost | Function to find the minimum cost required to make array elements equal.
Loop to find the count of odd elements.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to make array elements equal with minimum cost and the other steps required.
 def makearrayequal ( arr , n ) :
	x = 0 ;
	for i in range ( n ) :
		x += arr [ i ] & 1 ;
	print ( min ( x , n - x ) ) ;
if __name__ == " _ _ main _ _ " :
	arr = [ 4 , 3 , 2 , 1 ] ;
	n = len ( arr ) ;
	makearrayequal ( arr , n ) ;