#include<iostream>
#include<algorithm>
#include<numeric>
#include<iterator>
#include<vector>

using namespace std;
typedef unsigned int val;

int tate(char mass[260][260],int n)
{
	int count=0,a=0,b=0,ans=-1;
	
	while(1)
	{

		if(b==n)break;
		
		if(mass[a][b]=='0' || a==n)
		{ 
			
			if(ans<count) ans=count;

			a=0;b++;count=0;continue; 

		}
		
		a++;count++;

	}
	return ans;
}

int yoko(char mass[260][260],int n)
{
	int count=0,a=0,b=0,ans=-1;
	
	while(1)
	{

		if(a==n)break;
		
		if(mass[a][b]=='0' || b==n)
		{ 
			
			if(ans<count) ans=count;

			b=0;a++;count=0;continue; 

		}
		
		b++;count++;

	}
	return ans;
}


int main() 
{
	int n;
	while(cin>>n && n)
	{
		char mass[260][260];
		
		for(int i=0; i<n; i++) cin >> mass[i];

		int ans=-1;

		if( ans < tate( mass, n ) ) ans = tate( mass, n );
		if( ans < yoko( mass, n ) ) ans = yoko( mass, n );
		
		for(int i=0; i<n ;i++)
		{
			for(int j=0; j<n; j++)
			{
				
				if(mass[i][j]=='1')
				{
					int a=i,b=j,count=0;
					while(1)
					{
						if( mass[a][b] == '0' || b<0 || n<a) break;
						mass[a][b]='0';
						count++;
						a++;b--;
						if(b==n){ a++;b=n-1; }
					}
					if(ans<count) ans=count;
				}
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}