Utility Function to answer the queries
def getDistinctCount ( queries , ar , seg , n ) : NEW_LINE INDENT for i in range ( len ( queries ) ) : NEW_LINE INDENT op = queries [ i ] [ 0 ] NEW_LINE if ( op == 2 ) : NEW_LINE INDENT l = queries [ i ] [ 1 ] NEW_LINE r = queries [ i ] [ 2 ] NEW_LINE tempMask = query ( 0 , n - 1 , l - 1 , r - 1 , 1 , seg ) NEW_LINE countOfBits = 0 NEW_LINE DEDENT DEDENT DEDENT