class Solution { public: int NumberOf1(int n) { unsigned int un = n; int res = 0; while(un != 0){ if(un & 1 == 1) res ++ ; un >>= 1; } return res; } };