Counting the set bits which denote the distinct elements
for ( int i = 63 ; i >= 0 ; i -- ) { if ( tempMask & ( 1LL << i ) ) { countOfBits ++ ; } } cout << countOfBits << ' ' } else { int index = queries [ i ] [ 1 ] ; int val = queries [ i ] [ 2 ] ;