#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(void)
{ 
	int n;
	while( cin >> n && n )
	{
		vector < string > map(n);
		for ( int i = 0; i < n; i++ )
			cin >> map[i];

		int answer = 0;
		int cnt;
		for ( int i = 0; i < n; i++ )
		{
			cnt = 0;
			for ( int j = 0; j < n; j++ )
			{
				if ( map[j][i] == '1' )
					cnt++;
			}
			answer = max( answer, cnt );

			cnt = 0;
			for ( int j = 0; j < n; j++ )
			{
				if ( map[i][j] == '1' )
					cnt++;
			}
			answer = max( answer, cnt );
		}

		for ( int i = 0; i < n; i++ )
		{
			for ( int j = 0; j < n; j++ )
			{
				cnt = 0;
				while ( i+cnt < n && j+cnt < n )
				{
					if ( map[i+cnt][j+cnt] == '0' )
						break;
					cnt++;
				}
				answer = max( cnt, answer );

				cnt = 0;
				while ( i+cnt >= 0 && j-cnt < n )
				{
					if ( map[i+cnt][j-cnt] == '0' )
						break;
					cnt++;
				}
				answer = max( cnt, answer );
			}
		}

		cout << answer << endl;

	}
	return 0;
}