#include<bits/stdc++.h>
using namespace std;
#define rep(i,a) for(int i = 0; i < (a); i++)
bool prime[10002];
int field[256][256];
int dx[] = {1,1,0}, dy[] = {-1,0,1};
int n;
int func(int x, int y, int k) {
	int cnt = 0;
	while(1) {
		if(x < 0 || x >= n || y < 0 || y >= n) break;
		if(field[y][x] == 0) break;
		x += dx[k], y+= dy[k];
		cnt += 1;
	}
	return cnt;
}
int main() {
	while(cin >> n,n) {
		rep(i,n){
			string str;
			cin >> str;
			rep(j, str.size()){
				field[i][j] = str[j] - '0';
			}
		}
		int ans = 0;
		rep(i, n) {
			rep(j, n) {
				if(field[i][j] == 0) continue;
				rep(k, 3) {
					ans = max(func(j,i,k),ans);
				}
			}
		}
		cout << ans << endl;
	}

	return 0;
}