primes-on-rails

The arrival times of N trains are given in the format hours : minutes : seconds. However for the sake of simplicity the time is considered only in seconds format i.e., 3600hours + 60minutes + seconds (Let's say this x). Now if x is a prime number, the halt for the train at the station is 5 minutes, if it's an odd number the halt is 3 minutes else the halt is 2 minutes. Now your task is find the minimum number of platforms required to accomodate all the arriving  trains in a station at any time.

Constraint:

1 ≤ N ≤ 100000

0 ≤ H ≤ 23

0 ≤ M,S ≤ 59

Input:

First line contains a number N

Next N lines contains 3 space separated integers H M S

Output:

Single integer containing the minimum of platforms needed to accomodate the trains

SAMPLE INPUT
5
11 57 9
20 25 53
8 41 3
16 58 30
21 47 8

SAMPLE OUTPUT
1

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions: