#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
 
#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)c.size())

typedef unsigned long long ull;
const int INF = (int)1e8;


int main(){
    int data[255][255];
    int rec[255][255];
    char buf[512];
    int n;
    int i, j, k;
    int ans;
    int dx[4] = {-1, 0, -1, 1};
    int dy[4] = {0, -1, -1, -1};
     
    while (scanf("%d", &n), n){
        for (i = 0; i < n; i++){
            scanf("%s", buf);
            for (j = 0; j < n; j++){
                data[i][j] = buf[j] - '0';
            }
        }
         
        ans = 0;
        for (i = 0; i < 4; i++){
            memset(rec, 0, sizeof(rec));
            for (j = 0; j < n; j++){
                for (k = 0; k < n; k++){
                    rec[j][k] = data[j][k];
                    if (0 <= k + dx[i] && k + dx[i] < n &&
                            0 <= j + dy[i] && j + dy[i] < n && rec[j][k] == 1){
                        rec[j][k] += rec[j + dy[i]][k + dx[i]];
                    }
                    ans = ans > rec[j][k] ? ans : rec[j][k];
                }
            }
        }
         
        printf("%d\n", ans);
    }
	
	return 0;
}