#include <iostream>
#include <algorithm>
#include <memory.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
char field[255][255];

int main(){
  int n;
  while(cin >> n && n){
    rep(i, n)rep(j, n) cin >> field[i][j];
    int res = 0;
    int cnt = 0;
    // yoko
    rep(i, n){
      cnt = 0;
      rep(j, n){
	if(field[i][j] == '1') cnt++;
	else cnt = 0;
	res = max(res, cnt);
      }
    }
    //tate
    rep(i, n){
      cnt = 0;
      rep(j, n){
	if(field[j][i] == '1') cnt++;
	else cnt = 0;
	res = max(res, cnt);
      }
    }
    
    rep(i, n){
      cnt = 0;
      rep(j, i+1){
	if(field[i-j][j] == '1') cnt++;
	else cnt = 0;
	res = max(res, cnt);
      }
    }
    //naname
    rep(i, n){
      cnt = 0;
      rep(j, n-i){
	if(field[n-j-1][i+j] == '1') cnt++;
	else cnt = 0;
	res = max(res, cnt);
      }
    }
    //naname  
    rep(i, n){
      cnt = 0;
      rep(j, n - i){
	if(field[i+j][j] == '1') cnt++;
	else cnt = 0;
      }
      res = max(res, cnt);
    }
    rep(i, n){
      cnt = 0;
      rep(j, n - i){
	if(field[j][i+j] == '1') cnt++;
	else cnt = 0;
      }
      res = max(res, cnt);
    }
    cout << res << endl;
  }
  return 0;
}