Now divide elements in two sets by comparing rightmost set bit of xor with bit at same position in each element .
for ( $ i = 0 ; $ i < $ size ; $ i ++ ) { if ( $ arr [ $ i ] & $ set_bit_no ) $ x = $ x ^ $ arr [ $ i ] ;