Counting the set bits which denote the distinct elements
for ( int s = 63 ; s >= 0 ; s -- ) { if ( ( tempMask & ( 1L << s ) ) > 0 ) { countOfBits ++ ; } } Console . WriteLine ( countOfBits ) ; } else { int index = queries [ i , 1 ] ; int val = queries [ i , 2 ] ;