#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

int main(){

  string s[10000];
  int n,x,y,k,ans;

  while(cin >> n, n){

    for(int i=0;i<n;i++) cin >> s[i];
    k = 0;

    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	ans = 0;
	for(x=i,y=j;y<n;y++){
	  if(s[x][y] != '1') break;
	  ans++;
	  k = max(k,ans);
	}

	ans = 0;
	for(x=i,y=j;x>=0;x--){
	  if(s[x][y] != '1') break;
	  ans++;
	  k = max(k,ans);
	}

	x = i;
	y = j;
       	ans = 0;
	while(x >= 0 && y < n){
	  if(s[x][y] != '1') break;
	  ans++;
	  x--;
	  y++;
	  k = max(k,ans);
	}

	x = i;
	y = j;
	ans = 0;
	while(x >= 0 && y >= 0){
	  if(s[x][y] != '1') break;
	  ans++;
	  x--;
	  y--;
	  k = max(k,ans);
	}

      }
    }

    cout << k << endl;
  }
}