int numOf1(int x) { int c = 0; while (x) { ++c; x &= x-1; } return c; }
int numOf1(int x) { if (!x) return 0; return x%2 + numOf1(x/2); }