#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
 
using namespace std;
 
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) r.begin(),r.end()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-3;
const double PI = acos(-1);

int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};

string s[300];
int n;
int tate[300][300], yoko[300][300], naname1[300][300], naname2[300][300];

int main(){
	while(cin>>n && n){
		rep(i, n) cin>>s[i];
		int ans = 0;
		rep(i, 300) rep(j, 300) tate[i][j] = yoko[i][j] = naname1[i][j] = naname2[i][j] = 0;
		rep(i, n){
			rep(j, n){
				tate[i+1][j+1] = (s[i][j]=='1'?tate[i][j+1]+1:0);
				yoko[i+1][j+1] = (s[i][j]=='1'?yoko[i+1][j]+1:0);
				naname1[i+1][j+1] = (s[i][j]=='1'?naname1[i][j]+1:0);
				ans = max({ans, tate[i+1][j+1], yoko[i+1][j+1], naname1[i+1][j+1]});
			}
		}
		for(int i = n; i > 0; i--){
			for(int j = 1; j <= n; j++){
				naname2[i][j] = (s[i-1][j-1]=='1'?naname2[i+1][j-1]+1:0);
				ans = max(ans, naname2[i][j]);
			}
		}
		cout<<ans<<endl;
	}
}