#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

int d[300][300];
int main() {
	int n;
	while (scanf("%d", &n), n) {
		rep(i, n)rep(j, n)scanf("%1d", &d[i][j]);
		int Max = 0;
		rep(i, n)rep(j, n) {
			int cnt = 0;
			for (int x = i, y = j; 0 <= x&&x < n && 0 <= y&&y < n; x++) {
				if (!d[x][y])break;
				cnt++;
			}
			Max = max(Max, cnt);
			cnt = 0;
			for (int x = i, y = j; 0 <= x&&x < n && 0 <= y&&y < n; y++) {
				if (!d[x][y])break;
				cnt++;
			}
			Max = max(Max, cnt);
			cnt = 0;
			for (int x = i, y = j; 0 <= x&&x < n && 0 <= y&&y < n; x++, y++) {
				if (!d[x][y])break;
				cnt++;
			}
			Max = max(Max, cnt);
			cnt = 0;
			for (int x = i, y = j; 0 <= x&&x < n && 0 <= y&&y < n; x++, y--) {
				if (!d[x][y])break;
				cnt++;
			}
			Max = max(Max, cnt);
		}
		printf("%d\n", Max);
	}
}