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

const int SIZE = 255;

int main()
{
	bool table[ SIZE ][ SIZE * 3 ];

	int n;
	while( cin >> n && n ){
		memset( table, 0, sizeof(table) );
		for( int i = 0; i < n; ++i ){
			for( int j = 0; j < n; ++j ){
				char c;
				cin >> c;
				table[ i ][ j + SIZE ] = c == '1' ? true : false;
			}
		}
		int maxLength = 0;
		for( int i = 0; i < n; ++i ){
			int col = 0, row = 0;
			for( int j = 0; j < n; ++j ){
				if( table[ i ][ j + SIZE ] ){
					++col;
					if( maxLength < col ) maxLength = col;
				}else{
					col = 0;
				}
				if( table[ j ][ i + SIZE ] ){
					++row;
					if( maxLength < row ) maxLength = row;
				}else{
					row = 0;
				}
			}
		}
		for( int i = 0; i < n; ++i ){
			int diaL = 0, diaR = 0;
			for( int j = 0; j < n; ++j ){
				if( table[ j ][ i + SIZE - j ] ){
					++diaL;
					if( maxLength < diaL ) maxLength = diaL;
				}else{
					diaL = 0;
				}
				if( table[ j ][ n - 1 - i + j + SIZE ] ){
					++diaR;
					if( maxLength < diaR ) maxLength = diaR;
				}else{
					diaR = 0;
				}
			}
		}
		cout << maxLength << endl;
	}

	return 0;
}