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
n=input()
p=[1]*100000
p[0]=p[1]=0
for i in xrange(2,100000):
	if p[i]:
		for j in xrange(2*i,100000,i):
			p[j]=0
a=[]
b=[]
for i in xrange(n):
	h,m,s=map(int,raw_input().split())
	t=3600*h+60*m+s
	a.append(t)
	if p[t]:
		b.append(t+5*60)
	elif t&1:
		b.append(t+3*60)
	else:
		b.append(t+2*60)
a.sort()
b.sort()
ans=tmp=i=j=0
while i<n and j<n:
	if a[i]<b[j]:
		tmp+=1
		ans=max(ans,tmp)
		i+=1
	else:
		tmp-=1
		j+=1
print ans