Utility Function to answer the queries
static void getDistinctCount ( int [ , ] queries , int [ ] ar , long [ ] seg , int n ) { for ( int i = 0 ; i < queries . GetLength ( 0 ) ; i ++ ) { int op = queries [ i , 0 ] ; if ( op == 2 ) { int l = queries [ i , 1 ] , r = queries [ i , 2 ] ; long tempMask = query ( 0 , n - 1 , l - 1 , r - 1 , 1 , seg ) ; int countOfBits = 0 ;