#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>


typedef long long ll;
const double Eps = 1e-6;

using namespace std;

int t[256][256];
int main()
{
	int n;
	while (scanf("%d", &n), n)
	{
		for (int i = 0; i < n; ++i)
			for (int j = 0; j < n; ++j)
				scanf("%1d", &t[i][j]);

		int maxLen = 0;
		for (int i = 0; i < n; ++i)
		{
			int v, h;
			v = h = 0;
			for (int j = 0; j < n; ++j)
			{
				if (t[i][j])
					maxLen = max(maxLen, ++v);
				else
					v = 0;
				if (t[j][i])
					maxLen = max(maxLen, ++h);
				else
					h = 0;
			}
			int a, b, c, d;
			a = b = c = d = 0;
			for (int j = 0; i+j < n; ++j)
			{
				if (t[j][i+j])
					maxLen = max(maxLen, ++a);
				else
					a = 0;
				if (t[i+j][j])
					maxLen = max(maxLen, ++b);
				else
					b = 0;
				if (t[j][n-1-i-j])
					maxLen = max(maxLen, ++c);
				else
					c = 0;
				if (t[i+j][n-1-j])
					maxLen = max(maxLen, ++d);
				else
					d = 0;
			}
		}
		printf("%d\n", maxLen);
	}

	return 0;
}