ranges based on their start times.mergedCount to 1, representing the count of merged intervals.maxEnd to the end of the first interval.ranges starting from the second interval.maxEnd.maxEnd to the maximum of its current value and the end of the current interval.mergedCount and update maxEnd to the end of the current interval.mergedCount, modulo 10^9 + 7.