#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

vector<int>primes;

const int adx[] = { 1,1,1,0,-1,-1,-1,0 };
const int ady[] = { 1,0,-1,-1,-1,0,1,1 };

int add(const int base, const int plus) {
	if (plus) {
		return base + 1;
	}
	else {
		return 0;
	}
}
vector<vector<vector<int>>>get_cumulative_sum(const vector<vector<int>>&field) {
	const int H = field.size();
	const int W = field[0].size();
	//0 :?????????1:??????2:?????????3:??? 4:?????????5:??? 6:?????? 7:???
	vector<vector<vector<int>>>sums(H, vector<vector<int>>(W, vector<int>(8)));
	for (int ny = 0; ny <H; ++ny) {
		for (int nx = 0; nx <W; ++nx) {
			for (int k = 0; k < 2; ++k) {
				int py = ny - ady[k];
				int px = nx - adx[k];
				if (!(px >= 0 && px <W && py >= 0 && py <H))continue;

				sums[ny][nx][k] = add(sums[py][px][k], field[ny][nx]);

			}
		}
	}
	for (int ny = H-1; ny >= 0; --ny) {
		for (int nx = 0; nx <W; ++nx) {
			for (int k = 2; k < 4; ++k) {
				int py = ny - ady[k];
				int px = nx - adx[k];
				if (!(px >= 0 && px <W && py >= 0 && py <H))continue;

				sums[ny][nx][k] = add(sums[py][px][k], field[ny][nx]);

			}
		}
	}
	for (int ny = H-1; ny >= 0; --ny) {
		for (int nx =W-1; nx >= 0; --nx) {
			for (int k = 4; k < 6; ++k) {
				int py = ny - ady[k];
				int px = nx - adx[k];
				if (!(px >= 0 && px <W && py >= 0 && py <H))continue;

				sums[ny][nx][k] = add(sums[py][px][k], field[ny][nx]);

			}
		}
	}
	for (int ny = 0; ny <H; ++ny) {
		for (int nx = W-1; nx >= 0; --nx) {
			for (int k = 6; k < 8; ++k) {
				int py = ny - ady[k];
				int px = nx - adx[k];
				if (!(px >= 0 && px <W && py >= 0 && py <H))continue;

				sums[ny][nx][k] = add(sums[py][px][k], field[ny][nx]);

			}
		}
	}
	return sums;
}

int main() {
	while (1) {

		int N; cin >> N;
		if (!N)break;
		vector<vector<int>>field(N+2, vector<int>(N+2));
		for (int i = 0; i < N; ++i) {
			string st; cin >> st;
			for (int j = 0;  j < N; ++j) {
				field[i+1][j+1] = st[j] - '0';
			}
		}
		auto vs(get_cumulative_sum(field));
		int ans = 0;
		for (auto aa : vs) {
			for (auto a : aa) {
				for (auto g : a) {
					ans = max(ans, g);
				}
			}
		}
		cout << ans << endl;
	}

	return 0;
}