Python, 3 lines
\nclass Solution:\n    def countExcellentPairs(self, nums, k):\n        b2n = [0] * 31\n        for a in set(nums): b2n[bin(a).count(\'1\')] += 1\n        retur
```\nclass Solution:\n    def countExcellentPairs(self, nums, k):\n        b2n = [0] * 31\n        for a in set(nums): b2n[bin(a).count(\'1\')] += 1\n        return sum(b2n[i] * b2n[j] for i in range(31) for j in range(31) if i + j >= k)\n```
[]