Please solve the programming task below using a self-contained code snippet in a markdown code block.

Given a positive integer n, write a function that returns the number of set bits in its binary representation (also known as the Hamming weight).
 
Please complete the following python code precisely:
```python
class Solution:
    def hammingWeight(self, n: int) -> int:
        
```