Python 3 | Solution
Code
# Code
```python3 []
class Solution:
    def countExcellentPairs(self, nums: List[int], k: int) -> int:
        
        nums = list(set(nums))

        nums = [Counter(bin(x))['1'] for x in nums]
        res = 0

        n = len(nums)
        l, r = 0, n - 1

        nums.sort()

        for l in range(n):

            while nums[r] + nums[l] >= k and r > -1:
                r -= 1

            r += 1

            res += (n - r)
            
            r = min(r, n - 1)
        return res
```
['Python3']