human
Rearrange array elements such that Bitwise AND of first N | Utility function to print the elements of an array.
Function to find the required arrangement.
There has to be atleast 2 elements.
Minimum element from the array.
Swap any occurrence of the minimum element with the last element.
Find the bitwise AND of the first ( n - 1 ) elements.
If the bitwise AND is equal to the last element then print the arrangement.
Driver code"
Solution in Python:

Write me a code to rearrange array elements such that Bitwise AND of first N and the other steps required?
assistant
#Here is code to rearrange array elements such that Bitwise AND of first N and the other steps required.
 def printArr ( arr , n ) :
	for i in range ( n ) :
		print ( arr [ i ] , end = " ▁ " ) ;
def findArrangement ( arr , n ) :
	if ( n < 2 ) :
		print ( " - 1" , end = " " ) ;
		return ;
	minVal = min ( arr ) ;
	for i in range ( n ) :
		if ( arr [ i ] == minVal ) :
			arr [ i ] , arr [ n - 1 ] = arr [ n - 1 ] , arr [ i ] ;
			break ;
	andVal = arr [ 0 ] ;
	for i in range ( 1 , n - 1 ) :
		andVal &= arr [ i ] ;
	if ( andVal == arr [ n - 1 ] ) :
		printArr ( arr , n ) ;
	else :
		print ( " - 1" ) ;
if __name__ == " _ _ main _ _ " :
	arr = [ 1 , 5 , 3 , 3 ] ;
	n = len ( arr ) ;
	findArrangement ( arr , n ) ;