#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> PLL;

constexpr int dx[4] = {-1, -1, -1, 0};
constexpr int dy[4] = {1, 0, -1, -1};

bool solve() {
    int N;
    string d[255];
    cin >> N; if (N == 0) { return false; }

    for (int j = 0; j < N; ++j) {
        cin >> d[j];
    }

    int dp[255][255][4];
    for (int j = 0; j < N; ++j) {
        for (int k = 0; k < N; ++k) {
            fill(dp[j][k], dp[j][k]+4, 0);
        }
    }

    int ret = 0;

    for (int j = 0; j < N; ++j) {
        for (int k = 0; k < N; ++k) {
            if (d[j][k] == '0') { continue; }
            for (int l = 0; l < 4; ++l) {
                dp[j][k][l] = 1;

                int px = j+dx[l], py = k+dy[l];
                if (0 <= px && px < N && 0 <= py && py < N) {
                    dp[j][k][l] += dp[px][py][l];
                }

                ret = max(ret, dp[j][k][l]);
            }
        }
    }

    cout << ret << endl;
    return true;
}

int main() {
    while(solve());
    return 0;
}