#include <iostream>
#include <string>
#include <cmath>
#include <cstdlib>
#include <vector>

using namespace std;

int n;

const int MAX = 255;
int M[MAX][MAX];

int solve()
{
	int mval = 0;
	
	for(int i=0; i<n; i++)
	{
		int c = 0;
		for(int j=0; j<n; j++)
		{
			if(M[i][j]==1)
			{
				c++;
			}
			else
			{
				if(c > mval) mval =c;
				c = 0;
			}
		}
		
		if(c > mval)
		{
			mval = c;
		}
	}
	
	for(int i=0; i<n; i++)
	{
		int c = 0;
		for(int j=0; j<n; j++)
		{
			if(M[j][i]==1)
			{
				c++;
			}
			else
			{
				if(c > mval) mval =c;
				c = 0;
			}
		}
		
		if(c > mval)
		{
			mval = c;
		}
	}
	
	for(int i=0; i<n; i++)
	{
		int c = 0;
		for(int j=0; j<=i; j++)
		{
			if(M[i-j][j]==1) c++;
			else
			{
				mval = max(c, mval);
				c = 0;
			}
		}
		mval = max(c, mval);
		
		c = 0;
		for(int j=0; j<n-i; j++)
		{
			if(M[i+j][j]==1) c++;
			else
			{
				mval = max(c, mval);
				c = 0;
			}
		}
		mval = max(c, mval);
		
		c = 0;
		for(int j=0; j<=i; j++)
		{
			if(M[i-j][n-j-1]==1) c++;
			else
			{
				mval = max(c, mval);
				c = 0;
			}
		}
		mval = max(c, mval);
		
		c = 0;
		for(int j=0; j<n-i; j++)
		{
			if(M[i+j][n-j-1]==1) c++;
			else
			{
				mval = max(c, mval);
				c = 0;
			}
		}
		mval = max(c, mval);
		
		
	}
	
	return mval;
}

int main(int argc, char** argv)
{
	string tmp;
	char c[1];
	
	while(cin >> n, n)
	{
		for(int i=0; i<n; i++)
		{
			cin >> tmp;
			for(int j=0; j<n; j++)
			{
				memcpy(c, &tmp[j], sizeof(char));
				M[i][j] = atoi(c);
			}
		}
		
		cout << solve() << endl;;
	}
}