#include<stdio.h>
#define MAX 255
#define FOR(i,m,n) for(i=m;i<n;i++)
#define rep(i,n) FOR(i,0,n)
int max(int a,int b){return a>b?a:b;}
int main(void)
{
  int n,i,j,res;
  char F[MAX][MAX],r[MAX][MAX],l[MAX][MAX],u[MAX][MAX],rl[MAX][MAX],t;
  for(;;){
    scanf("%d",&n); if(!n)break;
    res=0;
    rep(i,n)rep(j,n){
      scanf(" %c ",F[i]+j);
      F[i][j]^='0';
      rl[i][j]=u[i][j]=r[i][j]=l[i][j]=F[i][j]?1:0;
      if(F[i][j])res=1;
    }
    rep(i,n)rep(j,n){
      if(F[i][j]){
        if(i&&j+1<n&&r[i-1][j+1]){
          r[i][j]=r[i-1][j+1]+1;
        }
        if(i&&j&&l[i-1][j-1]){
          l[i][j]=l[i-1][j-1]+1;
        }
        if(i&&u[i-1][j]){
          u[i][j]=u[i-1][j]+1;
        }
        if(j&&rl[i][j-1]){
          rl[i][j]=rl[i][j-1]+1;
        }
      }
      else{
        l[i][j]=0;
        r[i][j]=0;        
        u[i][j]=0;
        rl[i][j]=0;
      }
      res=max(max(res,max(rl[i][j],u[i][j])),max(r[i][j],l[i][j]));
    }
    printf("%d\n",res);
  }
  return 0;
}