#include <algorithm>
#include <iostream>
#include <string>
#include <queue>
#define MAX_N 255
using namespace std;

int p[8] = {1, 0, -1, 0, 1, 1, -1, -1}, q[8] = {0, 1, 0, -1, 1, -1, 1, -1};
string grid[MAX_N];

int search(int n) {
  int maxi = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < 8; k++) {
	int count = 0;
	int x = i, y = j;
	for ( ; ; ) {
	  if (x < 0 || y < 0 || x >= n || y >= n || grid[x][y] == '0') break;
	  count++;
	  x += p[k];
	  y += q[k];
	}
	maxi = max(maxi, count);
      }
    }
  }
  return maxi;
}

void init() {
  for (int i = 0; i < MAX_N; i++) {
    grid[i] = "\0";
  }
}

int main() {
  while (true) {
    init();
    int n;
    cin >> n;
    if (n == 0) return 0;
    for (int i = 0; i < n; i++) {
      cin >> grid[i];
    }

    int ans = search(n);
    cout << ans << endl;
  }
}