#include <iostream>
#include <string>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
int calc(int nb[256][256], int n, int ret) {
	rep(i,n) {
		rep(j,n) {
			if(ret<nb[i][j]) ret = nb[i][j];		
		}
	}
	return ret;
}

int main() {
	int n;
	string s;
	while(cin >> n, n) {
		int b[256][256] = {};
		int nb[256][256] = {};
		rep(i,n) {
			cin >> s;
			rep(j,n) {
				b[i][j] = s[j]-'0';
			}
		}
		int ret = 0;
		rep(i,n) {
			rep(j,n) {
				if(i==0) {
					nb[i][j] = b[i][j];
					continue;
				}
				nb[i][j] = b[i][j] ? nb[i-1][j]+b[i][j] : 0;
			}
		}
		ret = calc(nb,n,ret);
		rep(i,n) {
			rep(j,n) {
				if(j==0) {
					nb[i][j] = b[i][j];
					continue;
				}
				nb[i][j] = b[i][j] ? nb[i][j-1]+b[i][j] : 0;
			}
		}
		ret = calc(nb,n,ret);
		rep(i,2*n) {
			int k = i<n?i:2*n-i;
			rep(j,k) {
				if(j==0) {
					if(i<n) nb[n-i][0] = b[n-i][0];
					else nb[0][i-n] = b[0][i-n];
					continue;
				}
				if(i<n) nb[n-i+j][j] = b[n-i+j][j] ? nb[n-i+j-1][j-1]+b[n-i+j][j] : 0;
				else nb[j][i-n+j] = b[j][i-n+j] ? nb[j-1][i-n+j-1]+b[j][i-n+j] : 0;
			}
		}
		ret = calc(nb,n,ret);
		rep(i,2*n) {
			int k = i<n?i:2*n-i;
			rep(j,k) {
				if(j==0) {
					if(i<n) nb[n-i][n-1] = b[n-i][n-1];
					else nb[0][2*n-1-i] = b[0][2*n-1-i];
					continue;
				}
				if(i<n) nb[n-i+j][n-1-j] = b[n-i+j][n-1-j] ? nb[n-i+j-1][n-j]+b[n-i+j][n-1-j] : 0;
				else nb[j][2*n-1-i-j] = b[j][2*n-1-i-j] ? nb[j-1][2*n-i-j]+b[j][2*n-1-i-j] : 0;
			}
		}
		ret = calc(nb,n,ret);
		cout << ret << endl;
	}
	return 0;
}