#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int n;
string str[4][255];

int migi(int y,int x) {
  int count = 0;

  for(int i=x;i<n;i++){
    if(str[0][y][i] == '1') {
      count++;
      str[0][y][i] = '0';
    }
    else break;
  }
  return count;

}

int sita(int y,int x) {
  int count = 0;
  for(int i=y;i<n;i++) {
    if(str[1][i][x] == '1') {
      count++;
      str[1][i][x] = '0';
    }
    else break;
  }

  return count;
}

int migisita(int y,int x) {
  int count = 0;
  int i=0;
  while(1) {
    if(y+i == n || x+i == n) break;

    if(str[2][y+i][x+i] == '1'){
      str[2][y+i][x+i] = '0';
      count++;
    }
    else break;
    i++;
  }
  return count;
}

int hidarisita(int y,int x) {
 int count = 0;
  int i=0;
  while(1) {
    if(y+i == n || x-i == -1) break;

    if(str[3][y+i][x-i] == '1'){
      str[3][y+i][x-i] = '0';
      count++;
    }
    else break;
    i++;
  }
  return count;
}


int main(){
  while(1) {
  cin >> n;
  if(n == 0) break;

  for(int i=0;i<n;i++) {
    cin >> str[0][i];
    str[1][i] = str[2][i] = str[3][i] = str[0][i];
  }

  int ans = 0,t;
    for(int i=0;i<n;i++) {
      for(int j=0;j<n;j++) {
	if(str[0][i][j] == '1') ans = max(ans,migi(i,j));
	if(str[1][i][j] == '1') ans = max(ans,sita(i,j));
	if(str[2][i][j] == '1') ans = max(ans,migisita(i,j));
	if(str[3][i][j] == '1') ans = max(ans,hidarisita(i,j));
      }
    }

    cout << ans << endl;

  }

  return 0;
}