#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+8
#define EPS 1e-8
#define PB push_back
#define fi first
#define se second
#define ll long long 
#define reps(i,j,k) for(ll i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
int n;
int check(int y,int x,char field[256][256]){
    int res = 0;
    int ny = y;
    int nx = x;
    int tmp=0;
    while(true){
        if(nx < 0 || nx >= n || ny < 0 || ny >= n || field[ny][nx] == '0')break;
        tmp++;
        ny++;
    }
    res = max(res,tmp);
    ny = y;nx= x;tmp = 0;
    while(true){
        if(nx < 0 || nx >= n || ny < 0 || ny >= n || field[ny][nx] == '0')break;
        tmp++;
        nx++;
    }
    res = max(res,tmp);
    ny = y;nx= x;tmp = 0;
    while(true){
        if(nx < 0 || nx >= n || ny < 0 || ny >= n || field[ny][nx] == '0')break;
        tmp++;
        nx++;
        ny++;
    }
    res = max(res,tmp);
    ny = y;nx= x;tmp = 0;
    while(true){
        if(nx < 0 || nx >= n || ny < 0 || ny >= n || field[ny][nx] == '0')break;
        tmp++;
        nx--;
        ny++;
    }
    res = max(res,tmp);
    ny = y;nx= x;tmp = 0;
    return res;
}
int main(){
    while(scanf("%d",&n),n){
        char field[256][256];
        rep(i,n){
            scanf("%s",field[i]);
        }
        int ans = 0;
        rep(i,n){
            rep(j,n){
                if(field[i][j] == '1'){
                    ans = max(ans,check(i,j,field));
                }
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}