class Solution {
public:
     int  NumberOf1(int n) {
         int ret = 0;

         for (int i = 0; i < 32; ++i) {
             if (n & (1 << i))
                 ++ret;
         }
         return ret;
     }
};