Beats 100%
Code


# Code
```java []
class Solution {
    public int smallestNumber(int n) {
        double p=0,ans=0;
        if(n==1)
        return 1;
        for(int i=0;i<n;i++)
        {
            p=Math.pow(2,i);
            if(p>n)
            {
                ans=p-1;
                break;
            }
            
        }
        return (int)ans;
    }
}
```
['Java']