#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define F first
#define S second
#define INF 1 << 30

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int n;
char grid[256][256];

int solve(){
  int res = 0, c;
  rep(i, n){
    c = 0;
    rep(j, n){
      if(grid[i][j] == '1') res = max(res, ++c);
      else c = 0;
    }
  }

  rep(j, n){
    c = 0;
    rep(i, n){
      if(grid[i][j] == '1') res = max(res, ++c);
      else c = 0;
    }
  }

  rep(i, n){
    c = 0;
    rep(j, n){
      if(i - j < 0) break;
      if(grid[j][i-j] == '1') res = max(res, ++c);
      else c = 0;
    }
  }

  rep(i, n){
    c = 0;
    rep(j, n){
      if(n-j < 0 || n-i+j-1 >= n || n-i+j-1 < 0) break;
      if(grid[n-i+j-1][n-j] == '1') res = max(res, ++c);
      else c = 0;
    }
  }

  rep(i, n){
    c = 0;
    rep(j, n){
      if(n - i + j - 1>= n) break;
      if(grid[j][n-i+j-1] == '1') res = max(res, ++c);
      else c = 0;
    }
  }

  rep(i, n){
    c = 0;
    rep(j, n){
      if(i + j >= n) break;
      if(grid[i+j][j] == '1') res = max(res, ++c);
      else c = 0;
    }
  }

  return res;
}

int main(){
  while(scanf("%d", &n) && n){
    memset(grid, 0, sizeof(grid));
    rep(i, n) scanf("%s", grid[i]);
    printf("%d\n", solve());
  }
  return 0;
}