#include <stdio.h>
#include <math.h>

#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) cerr << #x << "=" << static_cast<bitset<16> >(x) << endl;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 10000000;
//int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
typedef pair<int, int> P;

/** Problem0151 : Grid **/
bool grid[256][256];
const int dx[8]={-1, 0, 1, -1, 1, -1, 0, 1}, dy[8]={-1, -1, -1, 0, 0, 1, 1, 1};
int N;

int search(int x, int y, int i)
{
	int num=1;
	while (1) {
		x+=dx[i]; y+=dy[i];
		if_range(x, y, N, N) {
			if (grid[x][y]) {
				num++;
				continue;
			}
		}
		break;
	}
	return num;
}

int main()
{
	while (cin>>N, N) {
		rep(i, N) {
			rep(j, N) {
				char c; cin>>c;
				if (c=='1')
					grid[j][i]=true;
				else
					grid[j][i]=false;
			}
		}
		
		int ans=0;
		rep(i, N) {
			rep(j, N) {
				if (grid[j][i]) {
					rep(k, 8) {
						ans = max(ans, search(j, i, k));
					}
				}
			}
		}
		cout << ans << endl;
	}
}