class Solution {
public:
int findComplement(int num) {
int count=0;
long long cot=0;
while (num){
int cnt=num%2,sum=0;
if (!cnt){
sum=pow(2,count);
}
count++;
num/=2;
cot+=sum;
}
return cot;
}
};