CodeForces - 237A


Free Cash



Submit Status




Description




Valera runs a 24/7 fast food cafe. He magically learned that next day n people will visit his cafe. For each person we know the arrival time: the i-th person comes exactly at hi hours miminutes. The cafe spends less than a minute to serve each client, but if a client comes in and sees that there is no free cash, than he doesn't want to wait and leaves the cafe immediately.

Valera is very greedy, so he wants to serve all n

Help Valera count the minimum number of cashes to work at his cafe next day, so that they can serve all visitors.






Input




The first line contains a single integer n(1 ≤ n ≤ 105), that is the number of cafe visitors.

Each of the following n lines has two space-separated integers hi and mi(0 ≤ hi ≤ 23; 0 ≤ mi ≤ 59), representing the time when the i-th person comes into the cafe.

Note that the time is given in the chronological






Output




Print a single integer — the minimum number of cashes, needed to serve all clients next day.






Sample Input





Input



48 08 108 108 45





Output



2





Input



30 1210 1122 22





Output



1







Hint




In the first sample it is not enough one cash to serve all clients, because two visitors will come into cafe in 8:10. Therefore, if there will be one cash in cafe, then one customer will be served by it, and another one will not wait and will go away.

In the second sample all visitors will come in different times, so it will be enough one cash.




Source



Codeforces Round #147 (Div. 2)



//题意:输入一个n,再输入n对h和m



表示给你n个时间点,问哪一个时间点出现的次数最大。




#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#define N 100010
using namespace std;
struct zz
{
	int h;
	int m;
}p[N];
bool cmp(zz a,zz b)
{
	if(a.h==b.h)
		return a.m<b.m;
	return a.h<b.h;
}
int main()
{
	int n,i,j;
	while(scanf("%d",&n)!=EOF)
	{
		for(i=0;i<n;i++)
			scanf("%d%d",&p[i].h,&p[i].m);
		sort(p,p+n,cmp);
		int cnt=1,mm=1;
		j=0;
		for(i=1;i<n;i++)
		{
			if(p[j].h==p[i].h&&p[j].m==p[i].m)
				cnt++;
			else
			{			
				j=i;
				cnt=1;
			}
			mm=max(mm,cnt);
		}
		printf("%d\n",mm);
	}
	return 0;
}




Time Limit: 2000MS

 

Memory Limit: 262144KB

 

64bit IO Format: %I64d & %I64u