#include <bits/stdc++.h>

using namespace std;

int MapData[255][255], DpResult[4][255][255], Ans[4], MaxLen;
string strOfRow;

void solve(int n) {
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (MapData[i][j] == 0) {
				continue;
			}

			//上下
			if (i > 0) {
				DpResult[0][i][j] = DpResult[0][i - 1][j] + 1;
			}
			//左右
			if (j > 0) {
				DpResult[1][i][j] = DpResult[1][i][j - 1] + 1;
			}
			//左斜め
			if (i > 0 && j > 0) {
				DpResult[2][i][j] = DpResult[2][i - 1][j - 1] + 1;
			}
			//右斜め
			if (i > 0 && j < n-1) {
				DpResult[3][i][j] = DpResult[3][i - 1][j + 1] + 1;
			}

			for (int k = 0; k < 4; k++) {
				Ans[k] = max(Ans[k], DpResult[k][i][j]);
				MaxLen = max(MaxLen, Ans[k]);
			}
		}
	}
	
}

void show(int n) {
	cout << "Dp:" << endl;
	for (int k = 0; k < 4; k++) {
		cout << "k=" << k << endl;
		for (int row = 0; row < n; row++) {
			for (int j = 0; j < n; j++) {
				cout << DpResult[k][row][j];
			}
			cout << endl;
		}
		cout << "ans=" << Ans[k] << endl << endl;
	}
}

int main() {
	int n;

	while (cin >> n, n) {
		memset(MapData, 0, sizeof(MapData));
		memset(DpResult, 0, sizeof(DpResult));
		memset(Ans, 0, sizeof(Ans));
		MaxLen = 0;
		for (int row = 0; row < n; row++) {
			cin >> strOfRow;
			for (int col = 0; col < n; col++) {
				MapData[row][col] = DpResult[0][row][col] = DpResult[1][row][col] = DpResult[2][row][col] = DpResult[3][row][col] = strOfRow[col] - '0';
			}			
		}
		solve(n);
		//show(n);
		cout << MaxLen << endl;
	}

	return 0;
}

