Count Set Bits
\nclass Solution:\n    def countExcellentPairs(self, nums: List[int], k: int) -> int:\n        nums = set(nums)\n        res = 0\n        ctr = [0] * 32\n      
```\nclass Solution:\n    def countExcellentPairs(self, nums: List[int], k: int) -> int:\n        nums = set(nums)\n        res = 0\n        ctr = [0] * 32\n        for el in nums:\n            x = "{:0b}".format(el).count("1")\n            ctr[x] += 1\n        for el in nums:\n            x = "{:0b}".format(el).count("1")\n            res += sum(ctr[max(k - x, 0):])\n \xA0 \xA0 \xA0 \xA0return res \n```
[]