Experienced employee Ivan Ivanovich is often sent on business trips to various cities. In the near future, he is scheduled to make $$$N$$$ business trips. For each trip, the range of days and the city where Ivan Ivanovich should be on those days are known.
Unfortunately, when scheduling business trips, the management sometimes makes mistakes. It may happen that on some day Ivan Ivanovich is supposed to be in two (or more) different cities at the same time. Write a program to count the number of such days.
The first line contains the number of business trips $$$N$$$ ($$$2 \le N \le 10^5$$$).
In each of the following $$$N$$$ lines, the start day $$$d_1$$$, the end day $$$d_2$$$ of the next business trip ($$$1 \le d_1 \le d_2 \le 10^9$$$), and the city number $$$c$$$ ($$$1 \le c \le 10^9$$$) are written separated by a space. The input data is sorted in non-decreasing order of $$$d_1$$$.
Print a single integer — the number of days in question.
Solutions that work correctly for $$$N \le 1000$$$, $$$d_2 \le 1000$$$, can score up to 50 points.
3 1 7 5 2 4 5 2 3 2
2
In the example, on the second and third days, Ivan Ivanovich is supposed to be simultaneously in cities 2 and 5.
Let's assume that all cities are located close to each other, so travel time is not considered in this problem.
Note for Python programmers: three numbers written separated by a space can be read as follows:
d1, d2, c = map(int, input().split())
| Name |
|---|


