eolymp
bolt
Try our new interface for solving problems
Problems

Film Festival

Film Festival

Time limit 1 second
Memory limit 128 MiB

The festival of French cinema, which will be held over one day, will demonstrate n films, for each of them we know the start time and and duration time of the show. Viewing takes place in a theater having sufficient number of halls for demonstrations, the transition between the halls takes less than a minute, that is, as soon as next minute after the previous session, you can catch the other. What is the largest number of films can be watched completely?

Input data

First line contains the number of films n~(1 \le n \le 100). Next n lines contains the beginning and the length of the i~(1 \le i \le n) film — two integers in format h hours m~(0 \le h \le 23, 0 \le m \le 59) minutes.

Output data

Print the maximum number of visited sessions.

Examples

Input example #1
3
10 10 1 20
11 15 1 30
11 40 2 0
Output example #1
2