Counting Bits Leetcode Solution Python