Calculates the number of 1's in the binary representation of a number