#include<iostream>
using namespace std;

int getMax( int a, int b );
int getWidth( int n, char m[255][255], int s, int t );
int getHeight( int n, char m[255][255], int s, int t );
int getDiagnal1( int n, char m[255][255], int s, int t );
int getDiagnal2( int n, char m[255][255], int s, int t );

int main()
{
    int n;
    char m[255][255];
    
    while( cin >> n )
    {
        if( n == 0 )
            break;

        for( int i = 0; i < 255; i++ )
            for( int j = 0; j < 255; j++ )
                m[i][j] = 0;

        for( int i = 0; i < n; i++ )
            for( int j = 0; j < n; j++ )
                cin >> m[i][j];
        
        int max = 0;
        for( int i = 0; i < n; i++ )
        {
            max = getMax( max, getHeight( n, m, 0, i ) );
            max = getMax( max, getWidth( n, m, i, 0 ) );
            max = getMax( max, getDiagnal1( n, m, 0, i ) );
            max = getMax( max, getDiagnal2( n, m, 0, i ) );
        }
        for( int i = 1; i < n; i++ )
            max = getMax( max, getDiagnal1( n, m, i, n - 1 ) );
        for( int i = 1; i < n; i++ )
            max = getMax( max, getDiagnal2( n, m, i, 0 ) );

        cout << max << endl;
    }

    return 0;
}

int getMax( int a, int b )
{
    if( a > b )
        return a;
    else
        return b;
}

int getWidth( int n, char m[255][255], int s, int t )
{
    int cnt = 0, max = 0;
    while( t < n )
    {
        if( m[s][t] == '1' )
        {
            cnt++;
            if( cnt > max )
                max = cnt;
        }
        else
            cnt = 0;
        t++;
    }
    return max;
}

int getHeight( int n, char m[255][255], int s, int t )
{
    int cnt = 0, max = 0;
    while( s < n )
    {
        if( m[s][t] == '1' )
        {
            cnt++;
            if( cnt > max )
                max = cnt;
        }
        else
            cnt = 0;
        s++;
    }
    return max;
}

int getDiagnal1( int n, char m[255][255], int s, int t )
{
    int cnt = 0, max = 0;
    while( s < n && t >= 0 )
    {
        if( m[s][t] == '1' )
        {
            cnt++;
            if( cnt > max )
                max = cnt;
        }
        else
            cnt = 0;
        s++;
        t--;
    }
    return max;
}


int getDiagnal2( int n, char m[255][255], int s, int t )
{
    int cnt = 0, max = 0;
    while( s < n && t < n )
    {
        if( m[s][t] == '1' )
        {
            cnt++;
            if( cnt > max )
                max = cnt;
        }
        else
            cnt = 0;
        s++;
        t++;
    }
    return max;
}
