#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, init, n) for(int i = init; i < (n); i++)

using namespace std;
using ll = long long int;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct
{
    int to, cost;
};

const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);

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

int main()
{
    int N;
    
    while(cin >> N, N)
    {
        int dp[300][300][4];

        rep(i, N) rep(j, N) rep(k, 4) dp[i][j][k] = 0;

        vector<string> grid(N);

        rep(i, N) cin >> grid[i];

        int ans = 0;

        rep(i, N)
        {
            rep(j, N)
            {
                if(grid[i][j] != '1') continue;

                if(j != 0) dp[i][j][0] = dp[i][j - 1][0] + 1;
                if(i != 0) dp[i][j][1] = dp[i - 1][j][1] + 1;
                if(i != 0 && j != 0) dp[i][j][2] = dp[i - 1][j - 1][2] + 1;
                if(i != 0 && j != N) dp[i][j][3] = dp[i - 1][j + 1][3] + 1;

                rep(k, 4) ans = max(ans, dp[i][j][k]);

            }
        }

        cout << ans + 1 << endl;

    }
    return 0;
}
