Here's a short solution to the problem in Python:

```
def countBits(n):
    return [bin(i).count('1') for i in range(n+1)]
```

This solution uses a list comprehension to generate the array. For each integer i in the range from 0 to n, the binary representation of i is calculated using the `bin()` function. The `count()` method is then used on this binary string to count the number of 1's in the representation. This count is added to the array being generated. Finally, the complete array is returned.
Given an integer n, return an array ans of length n + 1 such that for each i (0 <= i <= n), ans[i] is the number of 1's in the binary representation of i. Write the shortest possible solution in python.