Counting the set bits which denote the distinct elements
for i in range ( 63 , - 1 , - 1 ) : NEW_LINE INDENT if ( tempMask & ( 1 << i ) ) : NEW_LINE INDENT countOfBits += 1 NEW_LINE DEDENT DEDENT print ( countOfBits ) NEW_LINE else : NEW_LINE index = queries [ i ] [ 1 ] NEW_LINE val = queries [ i ] [ 2 ] NEW_LINE