loop do
    n = gets.to_i
    break if n == 0
    events = []
    n.times do
        t1, t2 = gets.chomp.split
        events += [[t1, 1], [t2, -1]]
    end
    count = max = 0
    events.sort.each do |t, d|
        count += d
        max = count if count > max
    end
    p max
end