✅Python Solution
\n# Code\n\nclass Solution:\n    def beautifulSubsets(self, nums: List[int], k: int) -> int:\n        def backtrack(i, cur): return (1 if cur else 0) + sum(back
\n# Code\n```\nclass Solution:\n    def beautifulSubsets(self, nums: List[int], k: int) -> int:\n        def backtrack(i, cur): return (1 if cur else 0) + sum(backtrack(i+1, cur | {nums[i]}) for i in range(i, len(nums)) if all(abs(nums[i] - x) != k for x in cur))\n        return backtrack(0, set())\n\n```
['Python3']