#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

const int MAXN = 256, R = 0, B = 1, RB = 2, LB = 3;

char tile[MAXN][MAXN];
int dp[4][MAXN][MAXN];

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

int main()
{
    int n;
    while(cin >> n && n)
    {
        rep(j,n)rep(i,n) cin >> tile[i][j];

        memset(dp, 0, sizeof(dp));

        rep(j,n)rep(i,n)rep(k,4)
            if(i + dx[k] <0 || i+dx[k] ==n || j+dy[k] <0 || j+dy[k] == n)
                dp[k][i][j] = tile[i][j] - '0';
            else
            {
                if(tile[i+dx[k]][j+dy[k]] == '0') 
                    dp[k][i][j] = tile[i][j] - '0';
                else
                    dp[k][i][j] = dp[k][i+dx[k]][j+dy[k]] + tile[i][j] - '0';
            }

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

        cout << ans << endl;


    }
    return 0;
}