def f():
    max_c = 0
    c = 0
    for h in range(n):
        for w in range(n):
            if grid[h][w] == 1:
                    c += 1
            else:
                if  max_c < c:
                    max_c = c
                c = 0
        else:
            if  max_c < c:
                max_c = c
            c = 0
    
    for w in range(n):
        for h in range(n):
            if grid[h][w] == 1:
                c += 1
            else:
                if  max_c < c:
                    max_c = c
                c = 0
        else:
            if  max_c < c:
                max_c = c
            c = 0
    
    for p in range(n):
        for a in range(n-p):
            if grid[p+a][0+a] == 1:
                c += 1
            else:
                if  max_c < c:
                    max_c = c
                c = 0
        else:
            if  max_c < c:
                max_c = c
            c = 0
        
    for p in range(1,n):
        for a in range(n-p):
            if grid[0+a][p+a] == 1:
                c += 1
            else:
                if  max_c < c:
                    max_c = c
                c = 0
        else:
            if  max_c < c:
                max_c = c
                
    for p in range(n):
        for a in range(n-p):
            if grid[p+a][n-1-a] == 1:
                c += 1
            else:
                if  max_c < c:
                    max_c = c
                c = 0
        else:
            if  max_c < c:
                max_c = c
            c = 0
            
    for p in range(n, -1, -1):
        for a in range(p):
            if grid[0+a][p-a] == 1:
                c += 1
            else:
                if  max_c < c:
                    max_c = c
                c = 0
        else:
            if  max_c < c:
                max_c = c
            c = 0
                
    print max_c
        
while True:
    n = input()
    if n == 0: break
    grid = [map(int, raw_input()) for i in range(n)]
    f()

### FIXED CODE ###

def f():
    max_c = 0
    c = 0
    for h in range(n):
        for w in range(n):
            if grid[h][w] == 1:
                    c += 1
            else:
                if  max_c < c:
                    max_c = c
                c = 0
        else:
            if  max_c < c:
                max_c = c
            c = 0
    
    for w in range(n):
        for h in range(n):
            if grid[h][w] == 1:
                c += 1
            else:
                if  max_c < c:
                    max_c = c
                c = 0
        else:
            if  max_c < c:
                max_c = c
            c = 0
    
    for p in range(n):
        for a in range(n-p):
            if grid[p+a][0+a] == 1:
                c += 1
            else:
                if  max_c < c:
                    max_c = c
                c = 0
        else:
            if  max_c < c:
                max_c = c
            c = 0
        
    for p in range(1,n):
        for a in range(n-p):
            if grid[0+a][p+a] == 1:
                c += 1
            else:
                if  max_c < c:
                    max_c = c
                c = 0
        else:
            if  max_c < c:
                max_c = c
            c = 0
                
    for p in range(n):
        for a in range(n-p):
            if grid[p+a][n-1-a] == 1:
                c += 1
            else:
                if  max_c < c:
                    max_c = c
                c = 0
        else:
            if  max_c < c:
                max_c = c
            c = 0
            
    for p in range(n, -1, -1):
        for a in range(p):
            if grid[0+a][p-1-a] == 1:
                c += 1
            else:
                if  max_c < c:
                    max_c = c
                c = 0
        else:
            if  max_c < c:
                max_c = c
            c = 0
                
    print max_c
        
while True:
    n = input()
    if n == 0: break
    grid = [map(int, raw_input()) for i in range(n)]
    f()