#include <iostream>
#include <vector>
#include <map>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <sstream>
using namespace std;

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define repp(i,k,n) for(int i=k;i<(int)n;i++)
#define rei(n) for(int i=0;i<(int)n;i++)
#define rel(n) for(int l=0;l<(int)n;l++)
#define al(s) s.begin(),s.end()

typedef pair<int, int> pi;
typedef pair<pi, pi> ppi;
typedef pair<int, ppi> pipp;


int main()
{
	int n;
	while (cin >> n&&n)
	{
		int ans = 0;
		vector<string> v;
		rei(n)
		{
			string s;
			cin >> s;
			v.push_back(s);
		}

		rei(n)
		{
			int j = 0;
			rel(n)
			{
				if (v[i][l] == '1')
				{
					j++;
				}
				else
				{
					j = 0;
				}
				ans = max(ans, j);
			}
		}
		rei(n)
		{
			int j = 0;
			rel(n)
			{
				if (v[l][i] == '1')
				{
					j++;
				}
				else
				{
					j = 0;
				}
				ans = max(ans, j);
				
			}
		}

		for (int i = 0; i < n; i++)
		{
			int j = 0;
			for (int l = 0; l < n - i; l++)
			{
				if (v[l][i + l] == '1')
				{
					j++;
				}
				else
				{
					j = 0;
				}
				ans = max(j, ans);
			}
			j = 0;
			for (int l = 0; l < n - i; l++)
			{
				if (v[i + l][l] == '1')
				{
					j++;
				}
				else
				{
					j = 0;
				}
				ans = max(j, ans);
			}
			j = 0;
			for (int l = 0; l <= i; l++)
			{
				if (v[i - l][l] == '1')
				{
					j++;
				}
				else
				{
					j = 0;
				}
				ans = max(ans, j);
			}
			j = 0;
			for (int l = 0; l <n- i; l++)
			{
				if (v[n-1-l][l+i] == '1')
				{
					j++;
				}
				else
				{
					j = 0;
				}
				ans = max(ans, j);
			}
		}
			
			
			
		cout << ans << endl;




	}
}