#include <iostream>
#include <algorithm>
using namespace std;

#define MAX 256

char s[MAX][MAX];
int n;

int findMax(int i, int j, int di, int dj){
	int count = 0, res = 0;

	while(i<n && j<n){
		if(s[i][j] == '1') count++;
		else{
			res = max(res, count);
			count = 0;
		}
		i += di;
		j += dj;
	}

	return max(res, count);
}

int main(void){
	while(cin>>n && n){
		for(int i=0;i<n;i++) cin>>s[i];

		int ans = -1;
		for(int i=0;i<n;i++){
			ans = max(ans, findMax(i,0,0,1));
			ans = max(ans, findMax(0,i,1,0));
			ans = max(ans, findMax(i,0,1,1));
			ans = max(ans, findMax(i,0,1,-1));
			ans = max(ans, findMax(0,i,1,1));
			ans = max(ans, findMax(0,i,1,-1));
		}

		cout<<ans<<endl;
	}

	return 0;
}