class Solution { public: int NumberOf1(int n) { int sum=0; for(int i=0;i<31;i+=1)if((n & (1<<i))==(1<<i))sum+=1; if(n<0)return sum+1; return sum; } };