human
Total pairs in an array such that the bitwise AND , bitwise OR and bitwise XOR of LSB is 1 | Function to find the count of required pairs.
To store the count of elements which give remainder 0 i . e . even values.
To store the count of elements which give remainder 1 i . e . odd values.
Driver code"
How can the above be solved in Python?
 ... Can you provide a code to total pairs in an array such that the bitwise AND , bitwise OR and bitwise XOR of LSB is 1 and the other steps required?
assistant
#Here is code to total pairs in an array such that the bitwise AND , bitwise OR and bitwise XOR of LSB is 1 and the other steps required.
 def CalculatePairs ( a , n ) :
	cnt_zero = 0
	cnt_one = 0
	for i in range ( 0 , n ) :
		if ( a [ i ] % 2 == 0 ) :
			cnt_zero += 1
		else :
			cnt_one += 1
	total_XOR_pairs = cnt_zero * cnt_one
	total_AND_pairs = ( cnt_one ) * ( cnt_one - 1 ) / 2
	total_OR_pairs = cnt_zero * cnt_one + ( cnt_one ) * ( cnt_one - 1 ) / 2
	print ( " cntXOR ▁ = ▁ " , int ( total_XOR_pairs ) )
	print ( " cntAND ▁ = ▁ " , int ( total_AND_pairs ) )
	print ( " cntOR ▁ = ▁ " , int ( total_OR_pairs ) )
if __name__ == ' _ _ main _ _ ' :
	a = [ 1 , 3 , 4 , 2 ]
	n = len ( a )
	CalculatePairs ( a , n )