'Coding has over 700 languages', '67% of programming jobs aren’t in the
technology industry', 'Coding is behind almost everything that is powered
by electricity'

Topics

Everyday ninja sees a number in his dream but he doesn’t realize the meaning of that number. Somehow ninja manages to get the secret of his number. He comes to know that if he converts that number into binary and takes its complement and again converts it into decimal type he will get a lottery winning number of ‘Chit fund’ lottery.

But ninja is not good at maths so he is very sad about how he will get that lottery number from his dream’s number. So help our ninja in getting that lottery number.

Your task is to convert the given number into its binary form then take its complement ( Complement of a binary number is the value obtained by swapping all the bits i.e if ‘1’ is present you swap it with ‘0’ and vice versa ), then again convert it into its decimal representation.

Detailed explanation

```
2
4
6
```

```
3
1
```

```
Test Case 1:
For the first test case, the given number is ‘4’ so its binary representation is ‘1 0 0’ after taking its complement it looks like ‘0 1 1’. So now converting it into decimal we get ‘3’ so it’s our final answer.
Test Case 2:
For the first test case, the given number is ‘6’ so its binary representation is ‘1 1 0’ after taking its complement it looks like ‘0 0 1’. So now converting it into decimal we get ‘1’ so it’s our final answer.
```

```
1
9
```

```
6
```

```
Test Case 1:
For the first test case, the given number is ‘9’ so its binary representation is ‘1 0 0 1’ after taking its complement it looks like ‘0 1 1 0’. So now converting it into decimal we get ‘6’ so it’s our final answer.
```