1. def BitCounting(n):
    2. if n==1:
    3. return 1
    4. else:
    5. return BitCounting(n/2) + 1