# Codeforces847g universityclasses

Posted by yjjr's blog on February 6, 2018

## 标签：模拟

There are n student groups at the university.During the study day, each group can take no more than 7 classes. Seven time slots numberedfrom 1 to 7 are allocated for the classes.

Theschedule on Monday is known for each group, i. e. time slots when group willhave classes are known.

Your taskis to determine the minimum number of rooms needed to hold classes for allgroups on Monday. Note that one room can hold at most one group class in asingle time slot.

Input

The firstline contains a single integer n (1 ≤ n ≤ 1000) — the number ofgroups.

Each ofthe following n linescontains a sequence consisting of 7 zeroes andones — the schedule of classes on Monday for a group. If the symbol in aposition equals to1 then the group hasclass in the corresponding time slot. In the other case, the group has no classin the corresponding time slot.

Output

Printminimum number of rooms needed to hold all groups classes on Monday.

Example

Input

2
0101010
1010101

Output

1

Input

3
0101011
0011001
0110111

Output

3

Note

In thefirst example one room is enough. It will be occupied in each of the seven timeslot by the first group or by the second group.

In thesecond example three rooms is enough, because in the seventh time slot allthree groups have classes.

Code

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define dep(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

int n,ans=0,s[20];
char ch;
int main()
{
scanf("%d",&n);
rep(i,1,n)
rep(j,1,7){cin>>ch;s[j]+=ch-'0';}
rep(i,1,7)ans=max(ans,s[i]);
cout<<ans<<endl;
return 0;
}