#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;
int n;
vector< vector<int> > m;
int d[] = {-1,0,1};

int c(int x){
    int ans = 0;
    REP(i,3){
	int temp = 0;
	int j = 0;
	while(!(x+d[i]*j < 0 || n <=  x+d[i]*j )){
	    if(m[n-1-j][x+d[i]*j] == 1){
		temp++;
		ans = max(ans,temp);
	    }else{
		ans = max(ans,temp);
		temp = 0;
	    }
	    j++;
	    if(j == n) break;
	}
    }
    REP(i,3){
	int temp = 0;
	int j = 0;
	while(!(x+d[i]*j < 0 || n <=  x+d[i]*j )){
	    if(m[j][x+d[i]*j] == 1){
		temp++;
		ans = max(ans,temp);
	    }else{
		ans = max(ans,temp);
		temp = 0;
	    }
	    j++;
	    if(j == n) break;
	}
    }
    return ans;
}
int r(int x){
    int ans = 0;
    REP(i,3){
	int temp = 0;
	int j = 0;
	while(!(x+d[i]*j < 0 || n <=  x+d[i]*j )){
	    if(m[n-1-j][x+d[i]*j] == 1){
		temp++;
		ans = max(ans,temp);
	    }else{
		ans = max(ans,temp);
		temp = 0;
	    }
	    j++;
	    if(j == n) break;
	}
    }
    REP(i,3){
	int temp = 0;
	int j = 0;
	while(!(x+d[i]*j < 0 || n <=  x+d[i]*j )){
	    if(m[x+d[i]*j][j] == 1){
		temp++;
		ans = max(ans,temp);
	    }else{
		ans = max(ans,temp);
		temp = 0;
	    }
	    j++;
	    if(j == n) break;
	}
    }
    return ans;
}

int main(){
    while(true){
	cin >> n;
	if(n == 0) break;
	m = vector< vector<int> >(n,vector<int>(n,0));
	REP(i,n){
	    string s;
	    cin >> s;
	    REP(j,n){
		m[i][j] = (int)(s[j]-'0');
	    }
	}
	int ans = 0;
	REP(i,n){
	    ans = max(ans,r(i));
	    ans = max(ans,c(i));
	}
	cout << ans << endl;
    }
    return 0;
}