#include <iostream>
#include <vector>

using namespace std;

void solve()
{
	int n;
	while(cin >> n, n)
	{
		vector< vector<char> > field(n, vector<char>(n));
		for(int i = 0; i < n; ++i)
		{
			for(int j = 0; j < n; ++j)
			{
				cin >> field[i][j];
			}
		}
		int ans = 0;
		for(int i = 0; i < n; ++i)
		{
			for(int j = 0; j < n; ++j)
			{
				if(field[i][j] == '1')
				{
					int count = 1;
					int x = j;
					int y = i;
					while(x < n && field[y][x] == '1')
					{
						ans = max(ans, count);
						++count;
						++x;
					}

					count = 1;
					x = j;
					y = i;
					while(y < n && field[y][x] == '1')
					{
						ans = max(ans, count);
						++count;
						++y;
					}

					count = 1;
					x = j;
					y = i;
					while(x >= 0 && y < n && field[y][x] == '1')
					{
						ans = max(ans, count);
						++count;
						--x; ++y;
					}

					count = 1;
					x = j;
					y = i;
					while(x < n && y < n && field[y][x] == '1')
					{
						ans = max(ans, count);
						++count;
						++x; ++y;
					}
				}
			}
		}
		cout << ans << endl;
	}
}

int main()
{
	solve();
	return(0);
}