Counting Bits Leetcode Solution In Python