Python super-simple short & clean solution
\nclass Solution:\n    def bitwiseComplement(self, N: int) -> int:\n        if N==0:\n            return 1\n        \n        def countDigits(n):\n            i
```\nclass Solution:\n    def bitwiseComplement(self, N: int) -> int:\n        if N==0:\n            return 1\n        \n        def countDigits(n):\n            if n == 0:\n                return 0\n            return 1 + countDigits(n>>1)\n        \n        return (2**countDigits(N))-1-N\n```\n**Like it? please upvote...**
['Python3']