#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define maxup(a,b) (a=max(a,b))
#define minup(a,b) (a=min(a,b))
#define INF 999999999
int n;




int main(){
    int n;
    while(cin>>n&&n){
        int dp[256][256][4];
        rep(i,256)rep(j,256)rep(k,4)dp[i][j][k] = 0;
        vector<string> data(n);
        rep(i,n)cin>>data[i];

        rep(i,n){
            rep(j,n){
                if(data[i][j]=='1'){
                    if(j-1>=0)          dp[i][j][0] = dp[i  ][j-1][0]+1;
                    else                dp[i][j][0] = 1;
                    if(i-1>=0&&j-1>=0)  dp[i][j][1] = dp[i-1][j-1][1]+1;
                    else                dp[i][j][1] = 1;
                    if(i-1>=0)          dp[i][j][2] = dp[i-1][j  ][2]+1;
                    else                dp[i][j][2] = 1;
                    if(i-1>=0&&j+1>=0)  dp[i][j][3] = dp[i-1][j+1][3]+1;
                    else                dp[i][j][3] = 1;
                }
            }
        }
        int maxi = -1;
        rep(i,n){
            rep(j,n){
                rep(k,4){
                    maxup(maxi,dp[i][j][k]);
                }
            }
        }
        cout<<maxi<<endl;
    }
}
 