simple solution in python3
\n\n# Code\n\nclass Solution:\n    def countWays(self, ranges: List[List[int]]) -> int:\n        sorted_ranges = sorted(ranges, key=lambda x: x[0])\n        sta
\n\n# Code\n```\nclass Solution:\n    def countWays(self, ranges: List[List[int]]) -> int:\n        sorted_ranges = sorted(ranges, key=lambda x: x[0])\n        start, end = sorted_ranges[0][0], sorted_ranges[0][1]\n        counter = 0\n        for i, r in enumerate(sorted_ranges):\n            if sorted_ranges[i][0] <= end:\n                if sorted_ranges[i][1] > end:\n                    end = sorted_ranges[i][1]\n            else: \n                start = sorted_ranges[i][0]\n                counter += 1\n            if sorted_ranges[i][1]> end:\n                end = sorted_ranges[i][1]\n        counter += 1\n        grouping = (2**counter)% 1000000007\n\n        return grouping\n\n        \n```
['Python3']