#include<cstdio>
#include<algorithm>

using namespace std;

int grid[256][256];
int hor[256][256],ver[256][256],ske1[256][256],ske2[256][256];

int main()
{
	for(int n;scanf("%d ",&n),n;){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++)	grid[i][j]=getchar()-'0';
			getchar();
		}

		for(int i=0;i<n;i++){
			hor[i][0]=grid[i][0];
			ver[0][i]=grid[0][i];
			ske1[0][i]=ske2[0][i]=grid[0][i];
			ske1[i][0]=grid[i][0];
			ske2[i][n-1]=grid[i][n-1];
		}

		for(int i=0;i<n;i++){
			for(int j=1;j<n;j++){
				hor[i][j]=grid[i][j]?hor[i][j-1]+1:0;
				ver[j][i]=grid[j][i]?ver[j-1][i]+1:0;
			}
		}

		for(int i=1;i<n;i++){
			for(int j=1;j<n;j++){
				ske1[i][  j  ]=grid[i][  j  ]?ske1[i-1][j-1]+1:0;
				ske2[i][n-j-1]=grid[i][n-j-1]?ske2[i-1][n-j]+1:0;
			}
		}

		int lmax=0;
		for(int i=0;i<n;i++)for(int j=0;j<n;j++)
			lmax=max(lmax,max(max(hor[i][j],ver[i][j]),max(ske1[i][j],ske2[i][j])));
		printf("%d\n",lmax);
	}

	return 0;
}