0ms Python
Complexity
Time complexity: O(1)

Space complexity: O(1)
Code

# Complexity
- Time complexity: O(1)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def smallestNumber(self, n: int) -> int:
        a=bin(n).replace('0b', '')
        return 2**len(a) - 1
        
```
['Python3']