#include <iostream>
#include <string>
using namespace std;
int board[255][255],dx[] = {-1,0,1,-1,1,-1,0,1},dy[] = {-1,-1,-1,0,0,1,1,1};
int main(){
    int n,tx,ty,cnt,max;
    string str;
    while(cin >> n,n){
        max = 0;
        for(int i = 0;i < n;++i){
            cin >> str;
            for(int j = 0;j < str.size();++j){
                board[i][j] = (int)(str[j] - '0');
            }
        }
        for(int i = 0;i < n;++i){
            for(int j = 0;j < n;++j){
                if(board[i][j] == 1){
                    for(int k = 0;k < 8;++k){
                        cnt = 1;
                        tx = j + dx[k];
                        ty = i + dy[k];
                        while(0 <= tx && 0 <= ty && tx < n && ty < n && board[ty][tx] == 1){
                            ++cnt;
                            tx += dx[k];
                            ty += dy[k];
                        }
                        if(cnt > max) max = cnt;
                    }
                }
            }
        }
        cout << max << endl;
    }
    return 0;
}