---
description: '# Easy'
---

# 191. Number of 1 Bits(bit)

```python
class Solution:
    def hammingWeight(self, n: int) -> int:
        count = 0
        while n:
            if n & 1 == 1:
                count += 1
            n = n >> 1
        return count
```
