#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int n;
  while (cin >> n, n) {
    int dp[4][300][300] = {};
    for (int i = 0; i < n; i++) {
      string s;
      cin >> s;
      for (int j = 0; j < n; j++) {
        for (int k = 0; k < 4; k++) {
          dp[k][i][j] = s[j] == '1';
        }
      }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (dp[0][i][j] == 0) continue;
        if (i > 0) dp[0][i][j] += dp[0][i - 1][j];
        if (j > 0) dp[1][i][j] += dp[1][i][j - 1];
        if (i > 0 && j > 0) dp[2][i][j] += dp[2][i - 1][j - 1];
        if (i > 0 && j + 1 < n) dp[3][i][j] += dp[3][i - 1][j + 1];
        ans = max(ans, dp[0][i][j]);
        ans = max(ans, dp[1][i][j]);
        ans = max(ans, dp[2][i][j]);
        ans = max(ans, dp[3][i][j]);
      }
    }
    cout << ans << endl;
  }

  return 0;
}
