#include <iostream>
#include <string.h>
#include <algorithm>
using namespace std;

int n, m, t;
char s[255][256];

void check(int i, int j) {
	if (s[i][j] == '1') {
		t++;
		m = max(m, t);
	}
	else
		t = 0;
}

int main()
{	
	cin >> n;

	while (n > 0) {
		memset(s, 0, sizeof(s));

		for (int i = 0; i < n; i++)
			cin >> s[i];

		m = 0;
	
		for (int i = 0; i < n; i++) {
			t = 0;
			for (int j = 0; j < n; j++)
				check(i, j);
		}

		for (int i = 0; i < n; i++) {
			t = 0;
			for (int j = 0; j < n; j++)
				check(j, i);
		}

		for (int i = 0; i < n * 2 - 1; i++) {
			t = 0;
			for (int j = max(0, i - n); j <= min(i, n - 1); j++)
				check(i - j, j);
		}

		for (int i = 0; i < n * 2 - 1; i++) {
			t = 0;
			for (int j = max(0, n - 1 - i); j <= min(n - 1, n * 2 - 2 - i); j++)
				check(j, j + i - n + 1);
		}

		cout << m << endl;

		cin >> n;
	}

	return 0;
}
