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.
import java.io.*;
import java.util.*;

public class main
{
	private static InputStream stream;
	private static byte[] buf = new byte[1024];
	private static int curChar;
	private static int numChars;
	private static SpaceCharFilter filter;
	private static PrintWriter pw;
	//private static long mod = 1000000000 + 7;
	private static long mod=100000000;
	private static long mod1 = 1000000000 + 9;
	private static void soln()
	{
		int n=nextInt();
		int[] cnt=new int[7];
		for(int i=0;i<n;i++) {
			String s=nextLine();
			for(int j=0;j<7;j++) {
				int t=s.charAt(j)-'0';
				cnt[j]+=t;
				//System.out.println(t);
			}
		}
		int ans=0;
		for(int i=0;i<7;i++) {
			ans=Math.max(ans, cnt[i]);
		}
		pw.println(ans);
	}
	private static long ans(int l,int r,int[] arr) {
		if(l>=r)
			return 0;
		int mid=l+(r-l)/2;
		long ret=ans(l,mid,arr);
		long ret1=ans(mid+1,r,arr);
		ret=(ret+ret1)%mod;
		int cnt1=0;
		int cnt2=0;
		for(int i=l;i<=mid;i++)
			cnt1+=arr[i];
		for(int i=mid+1;i<=r;i++)
			cnt2+=arr[i];
		cnt1=Math.max(cnt1, cnt2);
		long[] dp=new long[cnt1+1];
		dp[0]=1;
		HashMap<Integer,Long> map=new HashMap<>();
		int sum=0;
		for(int i=mid+1;i<=r;i++) {
			long[] dp1=new long[cnt1+1];
			sum+=arr[i];
			for(int j=0;j<=cnt1;j++) {
				dp1[j]=dp[j];
				if(j-arr[i]>=0)
					dp1[j]=(dp1[j]+dp[j-arr[i]])%mod;
				int key=sum-2*j;
				if(!map.containsKey(key))
					map.put(key, 0L);
				map.put(key, (map.get(key)+dp1[j])%mod);
			}
			dp=dp1;
		}
		Arrays.fill(dp, 0);
		dp[0]=1;
		sum=0;
		for(int i=mid;i>=l;i--) {
			long[] dp1=new long[cnt1+1];
			sum+=arr[i];
			for(int j=0;j<=cnt1;j++) {
				dp1[j]=dp[j];
				if(j-arr[i]>=0)
					dp1[j]=(dp1[j]+dp[j-arr[i]])%mod;
				int key=2*j-sum;
				if(map.containsKey(key)) {
					ret=(ret+(map.get(key)*dp1[j])%mod)%mod;
				}
			}
			dp=dp1;
		}
		return ret;
	}
	private static int[] buildSuffix(String s,int n){
		Integer[] order=new Integer[n];
		for(int i=0;i<n;i++) order[i]=n-i-1;
		Arrays.sort(order,(a,b) -> Character.compare(s.charAt(a),s.charAt(b)));
		int[] sa=new int[n];
		int[] m_tmp=new int[n];
		for(int i=0;i<n;i++){
			sa[i]=order[i];
			m_tmp[i]=s.charAt(i);
		}
		for(int len=1;len<n;len<<=1){
			int[] tmp=m_tmp.clone();
			m_tmp[sa[0]]=0;
			for(int i=1;i<n;i++){
				m_tmp[sa[i]] = (tmp[sa[i-1]]==tmp[sa[i]] && sa[i-1] + len < n && 
								tmp[(sa[i-1]+(len>>1))]==tmp[(sa[i]+(len>>1))]) ? m_tmp[sa[i-1]]:i;
			}
			int[] cnt=new int[n];
			for(int i=0;i<n;i++) cnt[i]=i;
			int[] sa_tmp=sa.clone();
			for(int i=0;i<n;i++){
				int s1=sa_tmp[i]-len;
				if(s1>=0)
					sa[cnt[m_tmp[s1]]++]=s1;
			}
		}
		return sa;
	}
	private static int[] buildLCP(int[] sa,String s,int n){
		int[] ind=new int[n];
		for(int i=0;i<n;i++)
			ind[sa[i]]=i;
		int[] lcp=new int[n];
		for(int i=0, k=0; i<n; i++)
			if(ind[i] < n-1){
				for(int j=sa[ind[i]+1]; Math.max(i,j)+k < n && s.charAt(i+k)==s.charAt(j+k);) k++;
				lcp[ind[i]]=k;
				if(k>0) k--;
			}
		return lcp;
	}
	private static class Edge{
		int u,v;
		public Edge(int a,int b) {
			u=a;v=b;
		}
	}
	private static void shortestPath(LinkedList<Edge>[] l,int n,int k,int[] masks) {
		int tot=(int) Math.pow(2,k);
		int[][] dist=new int[n][tot];
		int[][] from=new int[n][tot];
		for(int i=0;i<n;i++)
			Arrays.fill(dist[i], Integer.MAX_VALUE);
		dist[0][masks[0]]=0;
		from[0][masks[0]]=-1;
		PriorityQueue<Long> q=new PriorityQueue<>();
		q.add((long) masks[0]);
		//System.out.println(0);
		while(!q.isEmpty()) {
			long cur=q.poll();
			//System.out.println(cur);
			int u = ((int) cur)>>>10;
			int mask=(int) (cur&(tot-1));
			//System.out.println((u+1)+" "+mask+" "+dist[u][mask]);
			if((cur>>>32) != dist[u][mask])
				continue;
			//System.out.println((u+1)+" "+Integer.toBinaryString(mask)+" "+dist[u][mask]);
			Iterator<Edge> it=l[u].listIterator();
			while(it.hasNext()) {
				Edge e=it.next();
				int len=dist[u][mask]+e.v;
				if(dist[e.u][mask|masks[e.u]]>len) {
					//System.out.println((e.u+1)+" "+(mask|masks[e.u])+" "+len+" "+Long.toBinaryString(((long)len << 32)+(e.u<<10)+mask));
					dist[e.u][mask|masks[e.u]]=len;
					from[e.u][mask|masks[e.u]]=u;
					q.add(((long)len << 32)+(e.u<<10)+(mask|masks[e.u]));
				}
			}
		}
		int ans=Integer.MAX_VALUE;
		//System.out.println(Integer.toBinaryString(tot-1));
		for(int i=0;i<tot;i++) {
			for(int j=0;j<tot;j++) {
				//System.out.println(Integer.toBinaryString(i)+" "+Integer.toBinaryString(j)+" "+dist[n-1][i]+" "+dist[n-1][j]);
				if((i|j) != (tot-1))
					continue;
				//System.out.println(i+" "+j);
				ans=Math.min(ans,Math.max(dist[n-1][i],dist[n-1][j]));
			}
		}
		pw.println(ans);
	}
	private static class Pair1 implements Comparable<Pair1>{
		int dist, affected, u;
		public Pair1(int a) {
			dist=Integer.MAX_VALUE;
			affected=Integer.MAX_VALUE;
			u=a;
		}
		public int compareTo(Pair1 another) {
			return this.dist!=another.dist?this.dist-another.dist:this.affected-another.affected;
		}
	}
	static void multiply(long[][] a, long[][] b, long m)
	{
		int n = a.length;
		long[][] mul = new long[n][n];
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
			{
				mul[i][j] = 0;
				for (int k = 0; k < n; k++)
					mul[i][j] = (mul[i][j] + (a[i][k] * b[k][j]) % m) % m;
			}
		}
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				a[i][j] = mul[i][j];
	}
	private static class DSU{
		int[] parent;
		int[] rank;
		int[] cnt;
		public DSU(int n){
			parent=new int[n];
			rank=new int[n];
			cnt=new int[n];
			for(int i=0;i<n;i++){
				parent[i]=i;
				rank[i]=1;
				cnt[i]=1;
			}
		}
		int find(int i){
	        while(parent[i] !=i){
	        	parent[i]=parent[parent[i]];
	        	i=parent[i];
	        }
	        return i;
	    }
		int Union(int x, int y){
	        int xset = find(x);
	        int yset = find(y);
	        if(xset==yset)
	        	return 0;
	        if(rank[xset]<rank[yset]){
	        	parent[xset] = yset;
		        rank[yset]+=rank[xset];
		        rank[xset]=0;
		        cnt[yset]+=cnt[xset];
		        cnt[xset]=0;
		        return yset;
	        }else{
	        	parent[yset]=xset;
	        	rank[xset]+=rank[yset];
	        	rank[yset]=0;
	        	cnt[xset]+=cnt[yset];
	        	cnt[yset]=0;
	        	return xset;
	        }
	    }
	}

	private static long pow(long a, long b, long c)
	{
		if (b == 0)
			return 1;
		long p = pow(a, b / 2, c);
		p = (p * p) % c;
		return (b % 2 == 0) ? p : (a * p) % c;
	}
	private static int block;
	private static class Mo implements Comparable<Mo>
	{
		int l;
		int r;
		int i;

		public Mo(int a, int b, int ind)
		{
			l = a;
			r = b;
			i = ind;
		}

		@Override
		public int compareTo(Mo arg0)
		{
			int b1 = this.l / block;
			int b2 = arg0.l / block;
			return (b1 != b2) ? (b1 - b2) : (this.r - arg0.r);
		}
	}

	private static long gcd(long n, long l)
	{
		if (l == 0)
			return n;
		return gcd(l, n % l);
	}
	public static void main(String[] args) throws Exception
	{
		new Thread(null, new Runnable()
		{
			@Override
			public void run()
			{
				/*
				 * try { InputReader(new FileInputStream(
				 * "C:\\Users\\hardik\\Desktop\\C-small-1-attempt1.in")); } catch
				 * (FileNotFoundException e) { // TODO Auto-generated catch block
				 * e.printStackTrace(); }
				 */
				InputReader(System.in);
				pw = new PrintWriter(System.out);
				/*
				 * try { pw=new PrintWriter(new
				 * FileOutputStream("C:\\Users\\hardik\\Desktop\\out.txt")); } catch
				 * (FileNotFoundException e) { // TODO Auto-generated catch block
				 * e.printStackTrace(); }
				 */
				soln();
				pw.close();
			}
		}, "1", 1 << 26).start();
	}

	public static void InputReader(InputStream stream1)
	{
		stream = stream1;
	}

	private static boolean isWhitespace(int c)
	{
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	private static boolean isEndOfLine(int c)
	{
		return c == '\n' || c == '\r' || c == -1;
	}

	private static int read()
	{
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars)
		{
			curChar = 0;
			try
			{
				numChars = stream.read(buf);
			} catch (IOException e)
			{
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	private static int nextInt()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-')
		{
			sgn = -1;
			c = read();
		}
		int res = 0;
		do
		{
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	private static long nextLong()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-')
		{
			sgn = -1;
			c = read();
		}
		long res = 0;
		do
		{
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	private static String nextToken()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do
		{
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	private static String nextLine()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do
		{
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString();
	}

	private static int[] nextIntArray(int n)
	{
		int[] arr = new int[n];
		for (int i = 0; i < n; i++)
		{
			arr[i] = nextInt();
		}
		return arr;
	}

	private static long[] nextLongArray(int n)
	{
		long[] arr = new long[n];
		for (int i = 0; i < n; i++)
		{
			arr[i] = nextLong();
		}
		return arr;
	}

	private static void pArray(int[] arr)
	{
		for (int i = 0; i < arr.length; i++)
		{
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	private static void pArray(long[] arr)
	{
		for (int i = 0; i < arr.length; i++)
		{
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	private static boolean isSpaceChar(int c)
	{
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

	private static char nextChar()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		char c1 = (char) c;
		while (!isSpaceChar(c))
			c = read();
		return c1;
	}

	private interface SpaceCharFilter
	{
		public boolean isSpaceChar(int ch);
	}
}