✅✔ SIMPLE PYTHON3 SOLUTION ✅✔ O)n log n ) time
UPVOTE if it is helpfull\n\n\nclass Solution:\n    def countBits(self,x):\n        ab = 0\n        while x:\n            x >>= 1\n            ab += 1\n        r
***UPVOTE*** if it is helpfull\n```\n\nclass Solution:\n    def countBits(self,x):\n        ab = 0\n        while x:\n            x >>= 1\n            ab += 1\n        return ab\n    def concatenatedBinary(self, n: int) -> int:\n        res = 0\n        mod = 10**9 + 7\n        for i in range(1, n+1):\n            res = ((res << self.countBits(i)) + i) % mod\n        return res\n```
['Python', 'Python3']