loop do
  n = gets.to_i
  break if n==0
  map = Array.new(n).map!{Array.new(n)}
  n.times do |i|
    map[i]=gets.chomp.split("")
  end
  ans =0
  n.times do |i|
    tmp=map[i].join("")
    tmp.split(/0+/).each do |arr|
      ans = [ans,arr.size].max
    end
  end
  tmap = map.transpose
  n.times do |i|
    tmp=tmap[i].join("")
    tmp.split(/0+/).each do |arr|
      ans = [ans,arr.size].max
    end
  end
  n.times do |i|
    n.times do |j|
      c=0
      n.times do |k|
        break if i+k>=n || j+k>=n
        break if map[i+k][j+k]=="0"
        c+=1
      end
      ans = [ans,c].max
      c=0
      n.times do |k|
        break if i+k>=n || j-k <0
        break if map[i+k][j-k]=="0"
        c+=1
      end
      ans = [ans,c].max
    end
  end
  puts ans
end