c# solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\npublic class Solution {\n    public int CountWays(int[][] ranges) {\n\n        if (ranges.Count() == 1) return 2;\n\n        Array.Sort(ranges, (a,b) => a[0].CompareTo(b[0]));\n        var n = 1;\n        var end = ranges[0][1];\n        foreach(var r in ranges)\n        {\n            if(r[0] <= end)  //no overlap\n            {\n                end = Math.Max(end, r[1]);\n            }\n            else\n            {\n                n++;\n                end = r[1];\n            }\n        }\n        var mod = 1000000007;\n        var ways =  BigInteger.ModPow(2, n,mod) ;\n\n        return (int)ways;\n\n    }\n}\n```
['C#']