#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	int n,ret,sum;
	while(cin >> n , n){
		ret = 0;
		vector< vector<char> > data(n,vector<char>(n+(n-1)*2,0));
		rep(i,n)rep(j,n){
			cin >> data[i][n-1+j];
			data[i][n-1+j]-='0';
		}
		rep(i,n){
			sum = 0;
			rep(j,n){
				if(data[i][n-1+j]==0)sum = 0;
				sum+=data[i][n-1+j];
				ret = max(ret,sum);
			}
		}
		rep(i,n){
			sum = 0;
			rep(j,n){
				if(data[j][n-1+i]==0)sum = 0;
				sum+=data[j][n-1+i];
				ret = max(ret,sum);
			}
		}
		rep(i,2*n-1){
			sum = 0;
			rep(j,n){
				if(data[j][i+j]==0)sum = 0;
				sum+=data[j][i+j];
				ret = max(ret,sum);
			}
		}	
		for(int i=n-1;i<n+(n-1)*2;i++){
			sum = 0;
			rep(j,n){
				if(data[j][i-j]==0)sum = 0;
				sum+=data[j][i-j];
				ret = max(ret,sum);
			}
		}
		cout << ret << endl;
	}
}