while n = gets.to_i
  break if n.zero?
  grid = []
  n.times { grid << gets.chars.map(&:to_i) }
  count = 0
  count_max = 0

  # row
  grid.each do |row|
    row.each do |n|
      if n.zero?
        count = 0
      else
        count += 1
        count_max = count if count_max < count
      end
    end
  end
  # p "row:#{count_max}"

  # column
  0.upto(n-1) do |i|
    count = 0
    0.upto(n-1) do |j|
      count += 1 if grid[j][i] == 1
    end
    count_max = count if count_max < count
  end

  # p "column:#{count_max}"

  # oblique line
  0.upto(n-1) do |i|
    0.upto(n-1) do |j|
      count = 0
      unless n-1 < i + count_max || n-1 < j + count_max
        0.upto(n-i-1) do |k|
          break if grid[i+k][j+k] == 0
          count += 1
        end
        count_max = count if count_max < count
      end
      count = 0
      unless i - count_max < 0 || n-1 < j + count_max
        0.upto(n) do |k|
          break if grid[i-k][j+k] == 0 || i-k < 0 || n-1 < j+k
          count += 1
        end
        count_max = count if count_max < count
      end
    end
  end

  # p "oblique line:#{count_max}"

  puts count_max
end