Kasi
At one of the train stations in Moscow, there are n ticket counters, each following a fixed daily schedule without breaks.
Your task is to calculate the total duration of time during the day when all the counters are open at the same time.
Input
The input begins with an integer N (0 ≤ N ≤ 10000), representing the number of ticket counters.
Each of the next N lines contains 6 integers. The first three integers specify the opening time of a counter in hours, minutes, and seconds (hours range from 0 to 23, while minutes and seconds range from 0 to 59). The next three integers specify the closing time in the same format. All integers are separated by spaces.
The opening time indicates that the counter is operational from that exact second, while the closing time indicates that the counter stops operating at that second. For instance, a counter open from 10 hours 30 minutes 30 seconds to 10 hours 35 minutes 30 seconds is operational for 300 seconds each day.
If the opening and closing times are identical, the counter operates continuously for 24 hours. If the opening time is later than the closing time, the counter operates overnight, starting before midnight and ending the next day.
Output
Output a single integer — the total number of seconds during the day when all N counters are simultaneously operational.