#include<bits/stdc++.h>
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------

int N;
vector<string> G;

int solve(int row,int col){
    int res = 0;
    for(int k=0; k<6; k++){
        int x = row;
        int y = col;
        int now = 0;
        while(x>=0 and x<N and y<N and y>=0){
            if(G[x][y]-'0' > 0) now++;
            else{
                chmax(res,now);
                now = 0;
            }
            y += dy[k];
            x += dx[k];
        }
        chmax(res,now);
    }
    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> N;
    while(N != 0){
        int ans = 0;
        G.resize(N);
        for(int i=0; i<N; i++){
            cin >> G[i];
        }
        for(int i=0; i<N; i++){
            chmax(ans,solve(i,0));
            chmax(ans,solve(0,i));
            chmax(ans,solve(i,N-1));
            chmax(ans,solve(N-1,i));
        }
        cout << ans << enld;
        cin >> N;
    }
    return 0;
}

