#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair

#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int n;
string field[260];

bool isIn(int x, int y){
    return 0 <= x && x < n && 0 <= y && y < n;
}

int getLength(int x, int y, int dx, int dy){
    int count = 1;
    while(isIn(x+dx*count, y+dy*count) && field[y+dy*count][x+dx*count] == '1') count++;
    return count;
}

int main(){
    while(cin >> n, n){
        rep(i, n) cin >> field[i];

        int res = 0;
        rep(i, n) rep(j, n){
            if(field[j][i] == '1'){
                for(int k=-1; k <=0; k++)for(int l=-1; l <=1; l++){
                    if(k == 0 && l == 0) continue;
                    res = max(res, getLength(i, j, k, l));
                }
            }
        }
        cout << res << endl;
    }
}