#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int mt[256][256];
int n;

int f(int i,int j){
	int k;
	int max=0;
	int c;
	c=0;
	for(k=0;k+j<n;k++){
		if(mt[i][k+j])c++;
		else break;
	}
	chmax(max,c);
	c=0;
	for(k=0;k+i<n;k++){
		if(mt[k+i][j])c++;
		else break;
	}
	chmax(max,c);
	c=0;
	for(k=0;k+i<n&&k+j<n;k++){
		if(mt[k+i][k+j])c++;
		else break;
	}
	chmax(max,c);
	c=0;
	for(k=0;k+i<n&&0<=j-k;k++){
		if(mt[k+i][j-k])c++;
		else break;
	}
	chmax(max,c);
	return max;
}

int main() {
	while(n=in()){
		int i,j;
		for(i=0;i<n;i++){
			for(j=0;j<n;j++){
				scanf("%1d",&mt[i][j]);
			}
		}
/*
for(i=0;i<n;i++){
	for(j=0;j<n;j++){
		cout<<mt[i][j];
	}
	cout<<endl;
}
*/
		int max=0;
		for(i=0;i<n;i++){
			for(j=0;j<n;j++){
				chmax(max,f(i,j));
			}
		}
		cout<<max<<endl;
	}
	return 0;
}