Help needed in segment tree questions?

How to solve this hackerearth problem??
Link: Counting the number of intervals | Practice Problems