class Solution {
  public:
    int NumberOf1(int n) {
        int count_ = 0;
        while (n) {
            count_++;
            n = n & (n - 1);
        }
        return count_;
    }
};