#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  while(1){
    int n,ans=0;
    scanf("%d\n",&n);
    if(n==0){
      return 0;
    }
    int i,j,k,a[300][300],b[300][300];
    char s;
    for(i=0;i<=n+1;i++){
      for(j=0;j<=n+1;j++){
        b[i][j]=0;
      }
    }
    for(i=1;i<=n;i++){
      for(j=1;j<=n;j++){
        scanf("%c",&s);
        a[i][j]=s-'0';
      }
      scanf("\n");
    }
    for(i=1;i<=n;i++){
      for(j=1;j<=n;j++){
        if(a[i][j]==1){
          b[i][j+1]=b[i][j]+1;
        }
      }
    }
    for(i=0;i<=n+1;i++){
      for(j=0;j<=n+1;j++){
        ans=max(ans,b[i][j]);
      }
    }
    for(i=0;i<=n+1;i++){
      for(j=0;j<=n+1;j++){
        b[i][j]=0;
      }
    }
    for(i=1;i<=n;i++){
      for(j=1;j<=n;j++){
        if(a[j][i]==1){
          b[j+1][i]=b[j][i]+1;
        }
      }
    }
    for(i=0;i<=n+1;i++){
      for(j=0;j<=n+1;j++){
        ans=max(ans,b[i][j]);
      }
    }
    for(i=0;i<=n+1;i++){
      for(j=0;j<=n+1;j++){
        b[i][j]=0;
      }
    }
    for(i=1;i<=n;i=k){
      k=i+1;
      for(j=1;j<=n && i>0;i--,j++){
        if(a[i][j]==1){
          b[i-1][j+1]=b[i][j]+1;
        }
      }
    }
    for(i=0;i<=n+1;i++){
      for(j=0;j<=n+1;j++){
        ans=max(ans,b[i][j]);
      }
    }
    for(i=0;i<=n+1;i++){
      for(j=0;j<=n+1;j++){
        b[i][j]=0;
      }
    }
    for(i=1;i<=n;i=k){
      k=i+1;
      for(j=1;j<=n && i<=n;i++,j++){
        if(a[i][j]==1){
          b[i+1][j+1]=b[i][j]+1;
        }
      }
    }
    for(i=0;i<=n+1;i++){
      for(j=0;j<=n+1;j++){
        ans=max(ans,b[i][j]);
      }
    }
    for(i=0;i<=n+1;i++){
      for(j=0;j<=n+1;j++){
        b[i][j]=0;
      }
    }
    for(i=1;i<=n;i=k){
      k=i+1;
      for(j=n;j>0 && i<=n;i++,j--){
        if(a[i][j]==1){
          b[i+1][j-1]=b[i][j]+1;
        }
      }
    }
    for(i=0;i<=n+1;i++){
      for(j=0;j<=n+1;j++){
        ans=max(ans,b[i][j]);
      }
    }
    for(i=0;i<=n+1;i++){
      for(j=0;j<=n+1;j++){
        b[i][j]=0;
      }
    }
    for(i=1;i<=n;i=k){
      k=i+1;
      for(j=n;j>0 && i>0;i--,j--){
        if(a[i][j]==1){
          b[i-1][j-1]=b[i][j]+1;
        }
      }
    }
    for(i=0;i<=n+1;i++){
      for(j=0;j<=n+1;j++){
        ans=max(ans,b[i][j]);
      }
    }
    cout << ans << endl;
  }
}
