Problem: 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

Solution (in PYTHON):

Solution:
def primes(n):
	if n==2: return[2]
	elif n<2: return []
	s=range(3,n+1,2)
	mroot=n**0.5
	half=(n+1)/2 -1
	i=0
	m=3
	while (m<=mroot):
		if s[i]:
			j=(m*m-3)/2
			s[j]=0
			while(j<half):
				s[j]=0
				j+=m
		i+=1
		m=2*i+3
	return [2]+[x for x in s if x]

p=set(primes(100000))
n=int(raw_input())
arr=[]
dep=[]
for i in xrange(n):
	h,m,s=map(int,raw_input().split())
	st=h*60*60 + m*60 +s
	en=st
	if st in p:
		en+=300
	elif st%2!=0:
		en+=180
	else:
		en+=120
	arr.append(st)
	dep.append(en)
arr.sort()
dep.sort()
need=1
res=1
i=1
j=0
while(i<n and j<n):
	if arr[i]<dep[j]:
		need+=1
		i+=1
		res=max(res,need)
	else:
		need-=1
		j+=1
print res