#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int n;
    string line[300];
    while (cin >> n && n) {
        for (int i = 0; i < n; i++) cin >> line[i];
        ll ans = 0;
        for (int i = 0; i < n; i++) {
            ll cnt = 0, len = 0;
            for (int j = 0; j < n; j++) {
                if (line[i][j] == '1') len++;
                else len = 0;
                cnt = max(cnt, len);
            }
            ans = max(ans, cnt);
        }
        for (int j = 0; j < n; j++) {
            ll cnt = 0, len = 0;
            for (int i = 0; i < n; i++) {
                if (line[i][j] == '1') len++;
                else len = 0;
                cnt = max(cnt, len);
            }
            ans = max(ans, cnt);
        }
        for (int j = 0; j < n; j++) {
            ll cy = 0, cx = j;
            ll cnt = 0, len = 0;
            while (0 <= cy && cy < n && 0 <= cx && cx < n) {
                if (line[cy][cx] == '1') len++;
                else len = 0;
                cnt = max(cnt, len);
                cy++, cx--;
            }
            ans = max(ans, cnt);
        }
        for (int j = n - 1; j >= 0; j--) {
            ll cy = 0, cx = j;
            ll cnt = 0, len = 0;
            while (0 <= cy && cy < n && 0 <= cx && cx < n) {
                if (line[cy][cx] == '1') len++;
                else len = 0;
                cnt = max(cnt, len);
                cy++, cx++;
            }
            ans = max(ans, cnt);
        }
        for (int j = 0; j < n; j++) {
            ll cy = n - 1, cx = j;
            ll cnt = 0, len = 0;
            while (0 <= cy && cy < n && 0 <= cx && cx < n) {
                if (line[cy][cx] == '1') len++;
                else len = 0;
                cnt = max(cnt, len);
                cy--, cx--;
            }
            ans = max(ans, cnt);
        }
        for (int j = n - 1; j >= 0; j--) {
            ll cy = n - 1, cx = j;
            ll cnt = 0, len = 0;
            while (0 <= cy && cy < n && 0 <= cx && cx < n) {
                if (line[cy][cx] == '1') len++;
                else len = 0;
                cnt = max(cnt, len);
                cy--, cx++;
            }
            ans = max(ans, cnt);
        }
        cout << ans << endl;
    }
}
