Find missing number by bitmasking

we separated the two groups , let say if we would have seaprated in two groups and we would have get both the numbers in same group then what we have to do .

for example :
arr ={1,3,5,6}
missing numbers are 2, and 4 and both have last bit 0
or let say if the arr ={2,3,4,6}

then 1 and 5 has the last bit 1

in these conditon what we have to do , i m not able to think