/*
  AOJ 0151
  Title:Grid
  @kankichi573
*/
#include <stdio.h>
int max(int x,int y) 
{
return  (((x)>(y))?(x):(y));
}
int n;
char grid[255][256];
int max_ren(int sx,int sy,int xoffs,int yoffs,int limit)
{
  int i,j,ren=0,max_=0;

  for(i=sx,j=sy;i<limit && i>=0 && j<limit && j >= 0 ;i+=xoffs,j+=yoffs)
    {
    if(grid[i][j]=='1')
      {
	ren++;
	if(ren>max_)
	  max_=ren;
      }
    else
      ren=0;
    }
  return(max_);
}
int solve()
{
  int i,ret;

  ret=0;
  for(i=0;i<n;i++)
    {
      ret=max(ret,max_ren(0,i,1,0,n));
      ret=max(ret,max_ren(0,i,1,1,n));
      ret=max(ret,max_ren(0,i,1,-1,n));
    }
  for(i=0;i<n;i++)
    {
      ret=max(ret,max_ren(i,0,0,1,n));
      ret=max(ret,max_ren(i,0,1,1,n));
    }
  return(ret);
}
main()
{
  int  i;

  while(scanf("%d",&n) && n)
    {
      for(i=0;i<n;i++)
	scanf("%s",&grid[i][0]);
      printf("%d\n",solve());
    }
  return(0);
}