// 2011/08/25 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int n;
		cin >> n;
		if(n==0)
			break;

		char G[257][257];
		for(int i=0; i<=n+1; i++)
			for(int j=0; j<=n+1; j++)
				G[i][j] = '0';

		for(int i=1; i<=n; i++)
			for(int j=1; j<=n; j++)
				cin >> G[i][j];

		int max = 0;
		for(int i=1; i<=n; i++){
			for(int j=1; j<=n; j++){
				if(G[i][j]=='0')
					continue;

				int cnt = 1;
				int I = i;
				int J = j;
				while(G[I][J-1]=='1'){
					cnt++;
					J--;
				}
				I = i;
				J = j;
				while(G[I][J+1]=='1'){
					cnt++;
					J++;
				}
				if(max<cnt)
					max = cnt;


				cnt = 1;
				I = i;
				J = j;
				while(G[I-1][J]=='1'){
					cnt++;
					I--;
				}
				I = i;
				J = j;
				while(G[I+1][J]=='1'){
					cnt++;
					I++;
				}
				if(max<cnt)
					max = cnt;

				cnt = 1;
				I = i;
				J = j;
				while(G[I-1][J-1]=='1'){
					cnt++;
					I--;
					J--;
				}
				I = i;
				J = j;
				while(G[I+1][J+1]=='1'){
					cnt++;
					I++;
					J++;
				}
				if(max<cnt)
					max = cnt;

				cnt = 1;
				I = i;
				J = j;
				while(G[I-1][J+1]=='1'){
					cnt++;
					I--;
					J++;
				}
				I = i;
				J = j;
				while(G[I+1][J-1]=='1'){
					cnt++;
					I++;
					J--;
				}
				if(max<cnt)
					max = cnt;
			}
		}

		cout << max << endl;
	}

	return 0;
}