a list of ranges contains the start and end values continuous ranges of integers. for example, [1,4] denotes all integers in the range from 1 to 4, or [1,2,3,4]. Divide the ranges into 2 groups such that any 2 ranges that have at least one common integer belong to the same group. given the list of ranges, find the no. of ways to distribute these ranges into 2 groups that satisfy the constraint and each group has at least one range. since the answer can be large, compute it modulo (10^9 + 7).
Example
Consider ranges = [[1,5], [3,8], [10,15], [13,14], [20,100]].
* [1,5] and [3,8] must belong to the same group since they have common integers 3,4 and 5.
* [10,15] and [13,14] must belong to the same group since they have common integers 13 and 14.
* All the other ranges can be distributed independently since they do not overlap.