#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

int n;
string field[256];

int vertical(int y, int x){
  int cnt = 0;
  while(1){
    if(y >= n || field[y][x] == '0') break;
    y++;
    cnt++;
  }
  return cnt;
}

int horizonal(int y, int x){
  int cnt = 0;
  while(1){
    if(x >= n || field[y][x] == '0') break;
    x++;
    cnt++;
  }
  return cnt;
}

int diagonal_left(int y, int x){
  int cnt = 0;
  while(1){
    if(x < 0 || y >= n || field[y][x] == '0') break;
    x--, y++;
    cnt++;
  }
  return cnt;
}

int diagonal_right(int y, int x){
  int cnt = 0;
  while(1){
    if(x >= n || y >= n || field[y][x] == '0') break;
    x++, y++;
    cnt++;
  }
  return cnt;
}

int main(){
  while(cin >> n, n){
    for(int i = 0 ; i < n ; i++){
      cin >> field[i];
    }
    
    int ans = 0;
    
    for(int i = 0 ; i < n ; i++){
      for(int j = 0 ; j < n ; j++){
	if(field[i][j] == '1'){
	  ans = max(ans, vertical(i, j));
	  ans = max(ans, horizonal(i, j));
	  ans = max(ans, diagonal_left(i, j));
	  ans = max(ans, diagonal_right(i, j));
	} 
      }
    }
    cout << ans << endl;
  }
  return 0;
}