For all possible pairs find maximum value pick current a [ i ] , a [ j ] and set i , j th bits in mask
max_value = max ( max_value , ( a [ i ] ^ a [ j ] ) + xorSum ( a , n , ( mask | ( 1 << i ) | ( 1 << j ) ) , dp ) ) ; } } }