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

The schedule on Monday is known for each group, i. e. time slots when group will have classes are known.

Your task is to determine the minimum number of rooms needed to hold classes for all groups on Monday. Note that one room can hold at most one group class in a single time slot.


-----Input-----

The first line contains a single integer n (1 ≤ n ≤ 1000) — the number of groups. 

Each of the following n lines contains a sequence consisting of 7 zeroes and ones — the schedule of classes on Monday for a group. If the symbol in a position equals to 1 then the group has class in the corresponding time slot. In the other case, the group has no class in the corresponding time slot.


-----Output-----

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


-----Examples-----
Input
2
0101010
1010101

Output
1

Input
3
0101011
0011001
0110111

Output
3



-----Note-----

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

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

Difficulty: competition

Starter code:

Solutions:
strings = int(input())

count = [0 for x in range(7)]

for k in range(strings):
    s = input()
    for index in range(7):
        if s[index] == '1':
            count[index] += 1

print(max(count))


n = int(input())
s = [0] * 7
for _ in range(n):
	mes = input()
	for i in range(7):
		s[i] += (mes[i] == '1')
print(max(s))

n=int(input())
w=[0,0,0,0,0,0,0]
for i in range(n):
    j=0
    for i in input():
        if i=='1':
            w[j]+=1
        j+=1
print(max(w))


n = int(input())
a = []
s = 0
for i in range (n):
    a.append(input())
for i in range(7):
    tmp = 0
    for e in range(n):
        tmp += int(a[e][i])
    if tmp > s:
        s = tmp
print(s)

n=int(input())
b=[]
for i in range(0,n):
    a=input()
    b.append(a)
ans=0
for j in range(0,7):
    count=0
    for i in range(0,n):
        if b[i][j]=='1':
            count+=1
    ans=max(ans,count)
print(ans)


n=int(input())
k=[]
for i in range(n):
    l=input()
    k.append(l)
maxs=0
for j in range(7):
    s=0
    for i in range(n):
       if k[i][j]=='1':s+=1
    if s>maxs:maxs=s
print(maxs)


n = int(input())
arr = [0 for i in range(7)]
for i in range(n):
    s = input()
    for j in range(7):
        if s[j] == '1':
            arr[j] += 1
print(max(arr))

n = int(input())
ans = 0
ans1 = 0
arr_ans = []
arr_slot = []
for i in range(n):
    arr_slot.append(input())
for i in range(7):
    for j in range(n):
        arr_ans.append(arr_slot[j][i])
    ans = arr_ans.count("1")
    if ans > ans1:
        ans1 = ans
        ans = 0
    arr_ans = []
print(ans1)

n = int(input());
A = [];
for q in range(0, 7):
    A.append(0);
c = 0;
while 1:
    if c == n:
        break;
    x = input();
    b = 0;
    for i in range(0, 7):
        if x[i] == '1':
            A[i] = A[i] + 1;
    c = c + 1;
max = 0;
for d in range(0, 7):
    if A[d] > max:
        max = A[d];
print(max);


def ug(s):
    index=[0]*7
    for x in s:
        #print(x)
        for i in range(7):
            if(x[i]=="1"):
                index[i]+=1
    #print(index)        
    return max(index)
    
def main():
    t=input()
    t=int(t)
    tosend=[]
    for i in range(t):
        s=input().strip()
        tosend.append(str(s))
    print(ug(tosend))
    
def __starting_point():
    main()
__starting_point()

n = int(input())

a = [0]*7

for i in range(n):
	b = input()
	for j in range(7):
		a[j] += int(b[j])
	
print(max(a))


n = int(input().strip())

classes = []
for _ in range(n):
	classes.append(int(input().strip()))

biggest = -1

for x in range(8):
	biggest = max(biggest, sum([x%10 for x in classes]))
	classes = [x//10 for x in classes]

print(biggest)

n=int(input());
count=[0 for i in range(7)];
for i in range(n):
    s=input();
    l=list(s);
    for j in range(len(l)):
        count[j]+=int(l[j]);
print((max(count)));


    
    
        

    


n = int(input())

a = [0] * 7

for i in range(n):
    s = input()
    for j in range(7):
        a[j] += ord(s[j]) - ord('0')

print(max(a))


n=int(input())
y=[0]*100
a=0
for i in range(n):
    x=input()
    n=len(x)
    for j in range(n):
        y[j]=y[j]+int(x[j])
print(max(y))


n=int(input())
y=[0]*100
a=0
for i in range(n):
    x=input()
    n=len(x)
    for j in range(n):
        y[j]=y[j]+int(x[j])
print(max(y))

n = int(input())
dictt ={}
arr=[]
for i in range(n):
    a = input()
    arr.append(a)
for i in range(0,n):
    for j in range(0,7):
        if (arr[i][j]=='1'):
            try:dictt[j]+=1
            except:dictt[j]=1
try:print(max(dictt.values()))
except:print(0)



a=int(input())
q,w,e,r,t,y,u=0,0,0,0,0,0,0
for i in range(a):
	b=input()
	q+=int(b[0])
	w+=int(b[1])
	e+=int(b[2])
	r+=int(b[3])
	t+=int(b[4])
	y+=int(b[5])
	u+=int(b[6])
print(max(q,w,e,r,t,y,u))


n = int(input())
l = [input() for _ in range(n)]
res = 0
for day in range(7):
    here = 0
    for i in range(n):
        if l[i][day] == '1':
            here += 1
    res = max(res, here)
print(res)

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

n = int(input())

l = [0] * 7
for _ in range(n):
    s = input()
    for i in range(7):
        l[i] += int(s[i])

print(max(l))


grp = int(input())
tab = [""] * grp
for _ in range(grp):
  tab[_] = input()
m = 0
for i in range(7):
  t = 0
  for seq in tab:
    t+=int(seq[i])
  if t > m:
    m = t
  if t == grp:
    break
print(m)  


n = int(input())
mas = []
maxx = 0
for i in range(n):
    mas.append(input())
for i in range(7):
    ses = 0
    for ii in range(n):
        if mas[ii][i] == '1':
            ses += 1
    if ses > maxx:
        maxx = ses
print(maxx)


print(max(map(lambda x: sum(map(int, x)), zip(*(list(input()) for i in range(int(input())))))))

n=int(input())
a=[]
for i in range(0,n):
    s=input()
    a.append(s)
c=0
m=0
for j in range(0,7):
    for k in range(0,n):
        if a[k][j]=='1':
            c+=1
    m=max(c,m)
    c=0
print(m)

n = int(input())
a = [0]*7
for k in range(0, n):
	s = input()
	for i in range(7):
		if s[i] == '1':
			a[i] += 1
print(max(a))