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

Solutions:
my_list = []
my_list_2 = [0] * 7
for i in range(int(input())):
	my_list.append(list(map(int, list(input()))))
for k in range(len(my_list)):
	for j in range(len(my_list[k])):
		my_list_2[j] += my_list[k][j]
print(max(my_list_2))


wd = 7

def maxsum(v):
	n = len(v)
	mx = 0
	for c in range(wd):
		cr = 0
		for d in range(n):
			if v[d][c] == '1':
				cr += 1
			if mx < cr:
				mx = cr
	return mx
n = int(input())
v = []
for c in range(n):
	v.append(input())
print(maxsum(v))


t = int(input())
classes = []
answer = 0
for i in range(t):
	s = input()
	classes.insert(i, s)
for i in range(7):
	room = 0
	for j in range(len(classes)):
		if int(classes[j][i]) == 1:
			room += 1
	if room > answer:
		answer = room
print(answer)


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())
L = []
for i in range(7):
	L.append(0)
for i in range(n):
	s = input()
	for j in range(7):
		if s[j] == '1':
			L[j] += 1
print(max(L))


group_count = int(input())
groups = []
count = 0
max_count = 0
for i in range(group_count):
	group_str = input()
	groups.append(group_str)
for i in range(7):
	count = 0
	for element in groups:
		if element[i] == '1':
			count += 1
	if count > max_count:
		max_count = count
print(max_count)


t = int(input())
l = []
d = [0, 0, 0, 0, 0, 0, 0]
for i in range(t):
	x = str(input())
	l.append(x)
for i in l:
	for j in range(0, 7):
		if i[j] == '1':
			d[j] += 1
ans = 0
for x in d:
	if x > ans:
		ans = x
print(ans)


n = int(input())
classes = [input() for group in range(n)]
ans = max([sum([int(c[i]) for c in classes]) for i in range(7)])
print(ans)


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


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())
table = [list(map(int, list(input()))) for i in range(n)]
rooms = [[table[i][j] for i in range(n)] for j in range(7)]
ans = [sum(rooms[i]) for i in range(7)]
print(max(ans))


n = int(input())
mx = 7
res = [0 for i in range(mx)]
for i in range(n):
	s = input()
	for i in range(mx):
		res[i] += int(s[i])
print(max(res))


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


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


n = int(input())
l = []
for i in range(n):
	l.append(input())
maior = 0
for j in range(7):
	cont = 0
	for i in l:
		if i[j] == '1':
			cont += 1
	maior = max(cont, maior)
print(maior)


n = int(input())
arr = [0, 0, 0, 0, 0, 0, 0]
for i in range(n):
	k = input()
	for j in range(len(k)):
		arr[j] += int(k[j])
print(max(arr))


l = [input() for i in range(int(input()))]
a = [i.count('1') for i in zip(*l)]
print(max(a))


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x) + '\n')
n = get_int()
matrix = []
for i in range(n):
	matrix.append(get_string())
m = 0
for i in range(len(matrix[0])):
	count = 0
	for j in range(n):
		if matrix[j][i] == '1':
			count += 1
	m = max(m, count)
print(m)


n = int(input())
a = [str(input()) for i in range(n)]
max = 0
for i in range(7):
	count = 0
	for k in range(n):
		count += int(a[k][i])
		if count > max:
			max = count
print(max)


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)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scanner = lambda : int(input())
string = lambda : input().rstrip()
get_list = lambda : list(read())
read = lambda : map(int, input().split())
get_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(beauty, s, n, count):
	pass
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
alphs = 'abcdefghijklmnopqrstuvwxyz'
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect

def solve():
	n = int(input())
	ans = [0] * 7
	for i in range(n):
		s = list(map(int, list(string())))
		for i in range(7):
			ans[i] += s[i]
	print(max(ans))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for i in range(1):
	solve()


n = int(input())
classes = []
for _ in range(n):
	a = list(map(int, ' '.join(list(input())).split()))
	classes.append(a)
mx = 0
for i in range(7):
	s = 0
	for j in range(n):
		s += classes[j][i]
	mx = max(s, mx)
print(mx)


n = int(input())
t = [0] * 7
for i in range(n):
	sp = input()
	for y in range(7):
		t[y] += int(sp[y])
print(max(t))


n = int(input())
l = [0] * 7
while n:
	n -= 1
	s = list(input())
	for i in range(7):
		if s[i] == '1':
			l[i] += 1
print(max(l))


import sys
n = int(input())
res = [0] * 7
for k in range(n):
	a = [int(i) for i in input()]
	for j in range(7):
		res[j] += a[j]
print(max(res))


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


n = int(input())
lines = []
for _ in range(n):
	lines.append(list(map(int, input())))
print(max((sum((lines[j][i] for j in range(n))) for i in range(len(lines[0])))))


n = int(input())
s = []
for i in range(n):
	s.append(input())
m = 0
for j in range(7):
	count = 0
	for i in range(n):
		count += int(s[i][j])
	if m < count:
		m = count
print(m)


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())
a = []
count = 0
for i in range(n):
	x = str(input())
	a.append(x)
for i in range(7):
	x = ''
	c = 0
	for j in range(n):
		x += a[j][i]
	for k in range(len(x)):
		if x[k] == '1':
			c += 1
	if c > count:
		count = c
print(count)


import os.path
from math import gcd, floor, ceil
from collections import *
import sys
mod = 1000000007
INF = float('inf')

def st():
	return list(sys.stdin.readline().strip())

def li():
	return list(map(int, sys.stdin.readline().split()))

def mp():
	return map(int, sys.stdin.readline().split())

def inp():
	return int(sys.stdin.readline())

def pr(n):
	return sys.stdout.write(str(n) + '\n')

def prl(n):
	return sys.stdout.write(str(n) + ' ')
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def solve():
	n = inp()
	ans = 0
	dp = [[0] * 7]
	for i in range(n):
		cur = [0 for j in range(7)]
		s = st()
		for j in range(7):
			cur[j] += (s[j] == '1') + dp[-1][j]
			ans = max(ans, cur[j])
		dp.append(cur)
	pr(ans)
for _ in range(1):
	solve()


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())
l = []
for i in range(n):
	l.append(input())
result = 0
for i in range(7):
	sum = 0
	for j in range(n):
		if l[j][i] == '1':
			sum += 1
	result = max(result, sum)
print(result)


n = int(input())
s = []
for i in range(n):
	h = [input()]
	h = list(map(int, str(h[0])))
	s.append(h)
t = [sum(i) for i in zip(*s)]
print(max(t))


n = int(input())
dicti = {}
dicti[0] = 0
dicti[1] = 0
dicti[2] = 0
dicti[3] = 0
dicti[4] = 0
dicti[5] = 0
dicti[6] = 0
for ltst in range(n):
	lst = input()
	for x in range(7):
		if lst[x] == '1':
			dicti[x] += 1
print(max(dicti.values()))


from collections import defaultdict
n = int(input())
cnt = defaultdict(int)
for i in range(n):
	s = input()
	for (index, i) in enumerate(s):
		cnt[index] += 1 if i == '1' else 0
print(max(list(cnt.values())))


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


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


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)


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())
x1 = 0
x2 = 0
x3 = 0
x4 = 0
x5 = 0
x6 = 0
x7 = 0
for i in range(n):
	s = input()
	x1 += int(s[0])
	x2 += int(s[1])
	x3 += int(s[2])
	x4 += int(s[3])
	x5 += int(s[4])
	x6 += int(s[5])
	x7 += int(s[6])
print(max(x1, x2, x3, x4, x5, x6, x7))


import sys
import math
import itertools
import functools
import collections

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return ' '.join(map(str, arr))

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
n = ii()
a = [list(input()) for i in range(n)]
ans = 0
for i in range(7):
	t = 0
	for j in range(n):
		t += int(a[j][i])
	ans = max(ans, t)
print(ans)


n = int(input())
d = [0] * 7
for i in range(n):
	s = list(input())
	for i in range(7):
		d[i] += int(s[i])
print(max(d))


n = int(input())
pair = [input() for i in range(n)]
_max = 0
for i in range(7):
	temp = [pair[j][i] for j in range(n)]
	_max = max(_max, temp.count('1'))
print(_max)


n = int(input())
c = [0, 0, 0, 0, 0, 0, 0]
for i in range(n):
	s = input()
	for j in range(7):
		c[j] = c[j] + int(s[j])
print(max(c))


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))


t = [0] * 7
for x in range(0, int(input())):
	i = list(map(int, input()))
	for x in range(0, 7):
		if i[x] == 1:
			t[x] += 1
print(max(t))


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


n = int(input())
i = 0
Max = 0
ar = [0, 0, 0, 0, 0, 0, 0]
while i < n:
	schedule = input()
	for k in range(7):
		if schedule[k] == '1':
			ar[k] += 1
	i += 1
i = 0
for i in range(7):
	if ar[i] > Max:
		Max = ar[i]
print(Max)


n = int(input())
s = []
for _ in range(n):
	s.append([int(c) for c in input()])
ans = max(map(sum, [t for t in zip(*s)]))
print(ans)


n = int(input())
a = [0] * 7
for i in range(n):
	b = input()
	for h in range(7):
		a[h] += b[h] == '1'
print(max(a))


import sys
import math
import bisect
import itertools
import random
import re

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


n = int(input())
s = []
for _ in range(n):
	s.append(input())
ans = 0
for i in range(7):
	count = 0
	for j in range(n):
		count += int(s[j][i])
	ans = max(ans, count)
print(ans)


n = int(input())
classroom = [0 for i in range(n)]
for j in range(n):
	classroom[j] = [int(x) for x in input()]
count = 0
for i in range(7):
	temp_count = 0
	for j in range(n):
		if classroom[j][i] == 1:
			temp_count = temp_count + 1
	count = max(count, temp_count)
print(count)


n = int(input())
l = []
for i in range(n):
	li = list(map(int, input()))
	l.append(li)
a = len(li)
num = []
for i in range(a):
	numm = 0
	for j in range(n):
		numm += l[j][i]
	num.append(numm)
print(max(num))


num1 = int(input())
list1 = [0 for u in range(7)]
for i in range(num1):
	d = input()
	for u in range(7):
		if d[u] == '1':
			list1[u] += 1
		else:
			continue
print(max(list1))


__ = []
for o in range(7):
	__.append(0)
for _1_ in range(int(input())):
	___ = input()
	for _2_ in range(7):
		__[_2_] += int(___[_2_])
print(max(__))


n = int(input())
groups = [None] * n
for i in range(n):
	groups[i] = input()
count = 0
for i in range(7):
	count_temp = 0
	for j in range(n):
		if groups[j][i] == '1':
			count_temp += 1
	if count < count_temp:
		count = count_temp
		if count == n:
			break
print(count)


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


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)


arr = [0 for i in range(7)]
for i in range(int(input())):
	temp = input()
	for i in range(7):
		arr[i] += int(temp[i])
print(max(arr))


A = [input() for _ in range(int(input()))]
print(max((col.count('1') for col in zip(*A))))


n = int(input())
y = []
for _ in range(0, n):
	y.append(input())
z = []
max1 = 0
for i in range(0, 7):
	c = int(y[0][i])
	for j in range(1, n):
		c = c + int(y[j][i])
	if max1 < c:
		max1 = c
print(max1)


n = int(input())
l = []
for _ in range(n):
	l.append(list(input()))
ans = 0
for i in range(7):
	li = []
	for ii in range(n):
		li.append(l[ii][i])
	ans = max(ans, li.count('1'))
print(ans)


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


def ug(s):
	index = [0] * 7
	for x in s:
		for i in range(7):
			if x[i] == '1':
				index[i] += 1
	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())
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())
schedules = []
for i in range(n):
	schedules.append(input())
minimum = 0
for i in range(7):
	activeSlots = 0
	for j in range(n):
		activeSlots += int(schedules[j][i])
	if activeSlots > minimum:
		minimum = activeSlots
print(minimum)


n = int(input())
a = []
ans = 0
p = 0
for i in range(n):
	a.append(list(input()))
for i in range(7):
	for j in range(n):
		if a[j][i] == '1':
			p += 1
	if p > ans:
		ans = p
	p = 0
print(ans)


n = int(input())
l = []
for x in range(n):
	l.append(input().strip())
m = 0
for y in range(7):
	count = 0
	for x in range(n):
		if l[x][y] == '1':
			count += 1
	m = max(m, count)
print(m)


G = int(input())
Classes = [0] * 7
for g in range(G):
	s = input()
	for (i, c) in enumerate(s):
		if c == '1':
			Classes[i] += 1
print(max(Classes))


a = int(input())
v = [0 for i in range(7)]
for i in range(a):
	s = input()
	for k in range(len(s)):
		if s[k] == '1':
			v[k] += 1
max = 0
for i in range(7):
	if v[i] > max:
		max = v[i]
print(max)


d = {x: x * 0 for x in range(1, 8)}
n = int(input())
for _ in range(n):
	s = input()
	for i in range(1, 8):
		if s[i - 1] == '1':
			d[i] = d[i] + 1
print(max(d.values()))


(p, z) = ([], [])
for x in range(int(input())):
	s = input()
	z.append(s)
k = zip(*z)
for x in k:
	p.append(x.count('1'))
print(max(p))


n = int(input())
li = []
min_room_need = 0
for i in range(n):
	li.append(input())
new_li = []
for i in li:
	for (index, value) in enumerate(list(i)):
		if value == '1':
			new_li.append(index)
new_li.sort()
if len(new_li) == 0:
	print(0)
else:
	max = 1
	for i in new_li:
		r = new_li.count(i)
		if r > max:
			max = r
	print(max)


n = int(input())
v = []
for i in range(n):
	v.append(input())
z = float('-inf')
for i in range(7):
	t = 0
	for j in range(n):
		if v[j][i] == '1':
			t += 1
	z = max(z, t)
print(z)


n = int(input())
pairs = 7
mas = [0] * 7
for i in range(n):
	cache = list(input())
	for i in range(pairs):
		mas[i] += int(cache[i])
print(max(mas))


n = int(input())
k1 = 0
k2 = 0
a = []
for i in range(0, n):
	a.append(str(input()))
for i in range(0, 7):
	for r in range(0, n):
		if a[r][i] == '1':
			k1 += 1
	if k1 > k2:
		k2 = k1
	k1 = 0
print(k2)


(n, ar) = (int(input()), [])
for i in range(n):
	ar.append(input())
arr = [0 for i in range(7)]
for slot in ar:
	for i in range(7):
		arr[i] += int(slot[i])
print(max(arr))


print(max([sum(x) for x in list(zip(*[list(map(int, list(input()))) for x in range(int(input()))]))]))


n = int(input())
tots = [0, 0, 0, 0, 0, 0, 0]
for i in range(n):
	group = [int(x) for x in input()]
	tots = [a + b for (a, b) in zip(tots, group)]
print(max(tots))


import math
t = int(input())
ls = []
a = [0] * 7
for i in range(t):
	ls.append(input())
for i in range(t):
	if ls[i][0] == '1':
		a[0] += 1
	if ls[i][1] == '1':
		a[1] += 1
	if ls[i][2] == '1':
		a[2] += 1
	if ls[i][3] == '1':
		a[3] += 1
	if ls[i][4] == '1':
		a[4] += 1
	if ls[i][5] == '1':
		a[5] += 1
	if ls[i][6] == '1':
		a[6] += 1
a.sort()
if a[-1] > 0:
	print(a[-1])
elif a[-1] == 0:
	print('0')
else:
	print('1')


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())
ans = 0
d = {}
for x in range(n):
	a = input()
	for i in range(7):
		if a[i] == '1':
			if i not in d:
				d[i] = 1
			else:
				d[i] += 1
for (key, val) in d.items():
	ans = max(ans, val)
print(ans)


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())
x = []
for i in range(0, n):
	s = input()
	for j in range(0, len(s)):
		if s[j] == '1':
			x.append(j + 1)
		else:
			continue
x.sort()
y = 1
z = 1
for i in range(0, len(x) - 1):
	if x[i] == x[i + 1]:
		y += 1
	elif y >= z:
		z = y
		y = 1
	else:
		y = 1
if len(x) == 0:
	print('0')
else:
	print(max(y, z))


n1 = int(input())
arr = []
for x in range(n1):
	string = input()
	arr.append(string)
count = []
for i in range(7):
	test = 0
	for x in arr:
		if x[i] == '1':
			test = test + 1
	count.append(test)
print(max(count))


n = int(input())
matrix = []
for i in range(0, n):
	string = input()
	arr = []
	for j in range(0, 7):
		arr.append(int(string[j]))
	matrix.append(arr)
s = [0, 0, 0, 0, 0, 0, 0]
for j in range(0, 7):
	for i in range(0, n):
		s[j] = s[j] + matrix[i][j]
print(max(s))


n = int(input())
ans = [0 for x in range(7)]
for i in range(n):
	a = list(input())
	for j in range(7):
		ans[j] += int(a[j])
print(max(ans))


n = int(input())
C = 7
d = [0] * C
for i in range(n):
	schedule = list(input())
	for c in range(C):
		d[c] += int(schedule[c])
print(max(d))


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)


group_count = int(input())
groups = []
slots = [0] * 7
for i in range(group_count):
	group_str = input()
	groups.append(group_str)
for group in groups:
	index = 0
	for element in list(group):
		if element == '1':
			slots[index] += 1
		index += 1
print(max(slots))


n = int(input())
i = 0
j = [0, 0, 0, 0, 0, 0, 0]
while i < n:
	t = list(input())
	for g in range(7):
		if t[g] == '1':
			j[g] += 1
	i += 1
j.sort()
print(j.pop())


n = int(input())
di = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0}
for i in range(n):
	a = input()
	for i in range(len(a)):
		if a[i] == '1':
			di[i] = di[i] + 1
max1 = 0
for i in di.values():
	if i > max1:
		max1 = i
print(max1)


n = int(input())
targ = [0] * 7
for x in range(n):
	l1 = [int(x) for x in list(input())]
	for y in range(7):
		targ[y] += l1[y]
print(max(targ))


n = int(input())
arr = [list(map(int, input().strip())) for i in range(n)]
ans = 0
for i in range(7):
	ans = max(ans, sum((arr[j][i] for j in range(n))))
print(ans)


N = int(input())
X = list()
for i in range(N):
	Temp = input()
	X.append(Temp)
Max = 0
for i in range(7):
	Max = max(Max, [X[j][i] for j in range(N)].count('1'))
	if Max == N:
		print(Max)
		exit()
print(Max)


a = [*zip(*[*open(0)][1:])]
print(max((x.count('1') for x in a)))


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))


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


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())
m = [0] * 7
for _ in range(n):
	s = input().strip()
	for j in range(7):
		if s[j] != '0':
			m[j] += 1
print(max(m))


d = {1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0}
for _ in range(int(input())):
	x = input()
	for i in range(1, 8):
		d[i] += int(x[i - 1] == '1')
print(max(d.values()))


d = [0] * 7
for i in range(int(input())):
	for (j, c) in enumerate(input()):
		if c == '1':
			d[j] += 1
print(max(d))


import sys
Input = sys.stdin.readline
a = [0] * 7
for i in range(int(input())):
	x = input()
	for j in range(7):
		a[j] += 1 if x[j] is '1' else 0
print(max(a))


t = int(input())
o = t
a = []
while t:
	x = input()
	a.append(x)
	t -= 1
maxc = 0
for i in range(7):
	count = 0
	for u in range(o):
		if a[u][i] == '1':
			count += 1
	if maxc < count:
		maxc = count
print(maxc)


cases = int(input())
matrix = []
while cases:
	cases -= 1
	lst = list(input())
	matrix.append(lst)
traverse = [[matrix[i][j] for i in range(len(matrix))] for j in range(len(matrix[0]))]
mx = -1
for row in traverse:
	if row.count('1') > mx:
		mx = row.count('1')
print(mx)


s1 = [0] * 7
for _ in range(int(input())):
	s = input()
	for i in range(0, 7):
		s1[i] += int(s[i])
print(max(s1))


n = int(input())
a = [0] * 7
for i in range(n):
	b = list(map(int, input()))
	a = [a[i] + b[i] for i in range(7)]
print(max(a))


n = int(input())
a = []
for i in range(n):
	a.append(input())
d = 0
l = 0
for i in range(7):
	l = 0
	for b in range(n):
		l += int(a[b][i])
	if l > d:
		d = l
print(d)


l = []
c = 0
n = int(input())
for i in range(n):
	l.append(list(input()))
for i in range(7):
	d = 0
	for j in range(n):
		if l[j][i] == '1':
			d += 1
	c = max(c, d)
print(c)


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


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)


def solve():
	l = int(input())
	arr = []
	for i in range(l):
		li = input()
		arr.append(li)
	algo = zip(*arr)
	maximumN = 0
	for i in list(algo):
		currenNum = 0
		for j in i:
			if j == '1':
				currenNum += 1
		if currenNum > maximumN:
			maximumN = currenNum
	print(maximumN)
while True:
	try:
		solve()
	except:
		break


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)


import sys
import math

def main():
	n = int(sys.stdin.readline().strip())
	l = [0] * 7
	for _ in range(n):
		s = sys.stdin.readline().strip()
		for i in range(len(s)):
			if s[i] == '1':
				l[i] += 1
	l.sort(reverse=True)
	print(l[0])
main()


n = int(input())
a = [0 for x in range(7)]
for _ in range(n):
	a = [x + y for (x, y) in zip(a, map(int, list(input())))]
print(max(a))


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))


from sys import maxsize, stdout, stdin, stderr
mod = int(1000000000.0 + 7)
import re

def tup():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())

def lint():
	return [int(x) for x in stdin.readline().split()]

def S():
	return input().strip()

def grid(r, c):
	return [lint() for i in range(r)]

def debug(*args, c=6):
	print('\x1b[3{}m'.format(c), *args, '\x1b[0m', file=stderr)
from math import log2, sqrt
n = I()
l = []
for _ in range(n):
	s = S()
	l.append(s)
cnt = 0
ma = -1
for j in range(7):
	for i in range(n):
		if l[i][j] == '1':
			cnt += 1
	if cnt > ma:
		ma = cnt
	cnt = 0
print(max(0, ma))


def main():
	n = int(input())
	counts = [0, 0, 0, 0, 0, 0, 0]
	for _ in range(n):
		classes = input()
		for i in range(7):
			counts[i] += classes[i] == '1'
	print(max(counts))
main()


n = int(input())
l = [0] * 7
for i in range(n):
	x = input()
	for j in range(7):
		l[j] += int(x[j])
print(max(l))


cases = int(input())
matrix = []
ans = 0
while cases:
	cases -= 1
	lst = list(input())
	if lst.count('1') == 0:
		pass
	elif lst.count('0') == 0:
		ans += 1
	else:
		matrix.append(lst)
mx = 0
if matrix:
	traverse = [[matrix[i][j] for i in range(len(matrix))] for j in range(len(matrix[0]))]
	for row in traverse:
		if row.count('1') > mx:
			mx = row.count('1')
print(mx + ans)


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


from sys import stdin
max_val = int(10000000000000.0)
min_val = int(-10000000000000.0)

def read_int():
	return int(stdin.readline())

def read_ints():
	return [int(x) for x in stdin.readline().split()]

def read_str():
	return input()

def read_strs():
	return [x for x in stdin.readline().split()]
nb_groups = int(input())
classes = [[x for x in input()] for _ in range(nb_groups)]
print(max([sum([int(x) for x in y]) for y in list(zip(*classes))]))


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())
l = list()
max1 = 0
for i in range(n):
	l.append(input())
for i in range(7):
	count = 0
	for j in range(n):
		if l[j][i] == '1':
			count += 1
	if count > max1:
		max1 = count
print(max1)


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


n = int(input())
a = [0] * 7
for i in range(n):
	s = list(map(int, list(input())))
	for j in range(7):
		a[j] += s[j]
print(max(a))


cnt = lambda s, i: s.count(i)
ii = lambda : int(input())
si = lambda : input()
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
n = ii()
c = 0
cls = [si() for _ in range(n)]
for i in [''.join(t) for t in zip(*cls)]:
	c = max(c, cnt(i, '1'))
print(c)


a = int(input())
lista = []
for i in range(a):
	lista.append(input())
numeros = []
contador = 0
for i in range(0, 7):
	for k in range(a):
		if lista[k][i] == '1':
			contador += 1
	numeros.append(contador)
	contador = 0
numeros.sort()
print(numeros[-1])


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())
a = []
for i in range(0, n):
	a.append([])
	str = input()
	for j in range(0, 7):
		a[i].append(int(str[j]))
max = 0
temp = 0
for i in range(0, 7):
	for j in range(0, n):
		if a[j][i] == 1:
			temp += 1
	if temp > max:
		max = temp
	temp = 0
print(max)


n = int(input())
ans = [0] * 7
for _ in range(n):
	for (i, el) in enumerate(input()):
		ans[i] += int(el)
print(sorted(ans)[-1])


n = int(input())
r = [0] * 7
for _ in range(n):
	for (i, b) in enumerate(input()):
		if b == '1':
			r[i] += 1
print(max(r))


n = int(input())
(q, w, e, r, t, y, u) = (0, 0, 0, 0, 0, 0, 0)
for i in range(n):
	(a, s, d, f, g, h, j) = list(input())
	q += int(a)
	w += int(s)
	e += int(d)
	r += int(f)
	t += int(g)
	y += int(h)
	u += int(j)
print(max(q, w, e, r, t, y, u))


n = int(input())
classes = []
for i in range(n):
	s = input()
	f = [int(i) for i in s]
	classes.append(f)
value = []
for i in range(7):
	k = 0
	for j in range(n):
		k += classes[j][i]
	value.append(k)
print(max(value))


n = int(input())
m = []
for _ in range(n):
	m.append(input())
ans = 0
for i in range(7):
	ans = max(ans, [s[i] for s in m].count('1'))
print(ans)


def parser():
	while 1:
		data = list(input().split(' '))
		for number in data:
			if len(number) > 0:
				yield number
input_parser = parser()

def get_word():
	global input_parser
	return next(input_parser)

def get_number():
	data = get_word()
	try:
		return int(data)
	except ValueError:
		return float(data)
nums = []
n = get_number()
for i in range(n):
	nums.append(get_word())
audMax = 0
for i in range(7):
	curMinAud = 0
	for t in range(len(nums)):
		if nums[t][i] == '1':
			curMinAud += 1
	if audMax < curMinAud:
		audMax = curMinAud
print(audMax)


n = int(input())
arr = []
for i in range(n):
	arr.append(input())
p = 0
for i in range(7):
	x = p
	for j in arr:
		if j[i] == '1':
			if x > 0:
				x -= 1
			else:
				p += 1
print(p)


def f(l):
	l2 = []
	for i in range(len(l[0])):
		lx = []
		for j in range(len(l)):
			lx.append(l[j][i])
		l2.append(lx)
	return l2
n = int(input())
l = []
for i in range(n):
	l.append(list(input()))
l = f(l)
m = 0
for i in l:
	a = i.count('1')
	if a > m:
		m = a
print(m)


Input = lambda : map(int, input().split())
n = int(input())
ans = [0] * 7
for i in range(n):
	s = input()
	for j in range(7):
		ans[j] += int(s[j])
print(max(ans))


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


a = int(input())
slot1 = []
slot2 = []
slot3 = []
slot4 = []
slot5 = []
slot6 = []
slot7 = []
for i in range(a):
	b = input()
	slot1.append(int(b[0]))
	slot2.append(int(b[1]))
	slot3.append(int(b[2]))
	slot4.append(int(b[3]))
	slot5.append(int(b[4]))
	slot6.append(int(b[5]))
	slot7.append(int(b[6]))
print(max(sum(slot1), sum(slot2), sum(slot3), sum(slot4), sum(slot5), sum(slot6), sum(slot7)))


def university_classes():
	length = int(input())
	classes = []
	dic = {}
	classes.append(input())
	output = 0
	for i in range(len(classes[0])):
		if classes[0][i] == '1':
			dic[i] = 1
			if dic[i] > output:
				output = dic[i]
		else:
			dic[i] = 0
	for i in range(length - 1):
		classes.append(input())
	for i in range(1, len(classes)):
		for j in range(len(classes[i])):
			if classes[i][j] == '1':
				dic[j] += 1
				if dic[j] > output:
					output = dic[j]
	return output
A = university_classes()
print(A)


n = int(input())
c = [0] * 7
max = 0
for i in range(n):
	a = input()
	for j in range(7):
		if a[j] == '1':
			c[j] += 1
			max = c[j] if c[j] > max else max
print(max)