/*
 * 0151.cpp
 *
 *  Created on: 2011/07/27
 *      Author: isa
 */

#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>

using namespace std;

int main(void){
	int n;
	while(cin >> n && n){
		bool f[n+2][n+2];
		string str;
		int ans=0,tmp;
		memset(f,false,sizeof(f));
		for(int i=0;i<n;i++){
			cin >> str;
			for(int j=0;j<n;j++){
				f[i+1][j+1] = str[j] - '0';
			}
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(f[i+1][j+1] == true){
					int k=0;
					tmp = 0;
					while(f[i+1+k][j+1]) k++;
					tmp = max(tmp,k);
					k=0;
					while(f[i+1-k][j+1]) k++;
					tmp = max(tmp,k);
					k=0;
					while(f[i+1][j+1+k]) k++;
					tmp = max(tmp,k);
					k=0;
					while(f[i+1][j+1-k]) k++;
					tmp = max(tmp,k);
					k=0;
					while(f[i+1-k][j+1-k]) k++;
					tmp = max(tmp,k);
					k=0;
					while(f	[i+1-k][j+1+k]) k++;
					tmp = max(tmp,k);
					k=0;
					while(f[i+1+k][j+1-k]) k++;
					tmp = max(tmp,k);
					k=0;
					while(f[i+1+k][j+1+k]) k++;
					tmp = max(tmp,k);
					ans = max(ans,tmp);
				}
			}
		}
		cout << ans << endl;
	}
}