# Number of 1 Bits (Leetcode 191)

Problem Link: <https://leetcode.com/problems/number-of-1-bits/>

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