Amazon Interview Question

Given a number, write code to count how many 1s are there in its binary form