Don't think that Vasya spent all his time at the 2012 Olympics in London just solving problems. No, like most normal fans, he came to the Olympics to watch the competitions, and only solved problems in his spare time between events.
Of course, as a fan, Vasya wanted to attend as many competitions as possible, especially those of the sports he liked most. Luckily, the schedule for all the days was available online... But suddenly Vasya realized that going to the first available competition isn't always optimal, since he might end up seeing fewer competitions than if he followed a carefully planned schedule. Being a dedicated fan, Vasya took watching competitions seriously: once he started watching a competition, he would stay until the end. Also, he was pleased that all the competitions finished on the same day they started...
Help Vasya create a schedule that allows him to attend as many competitions as possible during his time at the Olympics.
The first line of the input contains the number of competitions Vasya likes, (1 \leq n \leq 100000). The next lines describe the list of competitions in the following format: first, the start time in the format hh:mm (00 \leq hh \leq 23, 00 \leq mm \leq 59), followed by a space, then the end time in the same format, and then the day of the competition (1 \leq d \leq 30) separated by a space. You may assume all competitions are held at the same location and Vasya's transit time between competitions can be neglected. Also, Vasya can get to a competition that starts at exactly the same time the previous one finishes.
A single number – the maximal number of competitions Vasya can attend.
Example 1