n segments [a_i, b_i] are given on a coordinate line. Find the number of pairs (i, j) such that i < j and segments [a_i, b_i] and [a_j, b_j] have at least one common point.
The first line contains an integer n (1 ≤ n ≤ 10^5). Each of the next n lines contains numbers a_i and b_i - the end points of a corresponding segment (-10^9 ≤ a_i, b_i ≤ 10^9).
Print the number of pairs of intersecting segments.