require 'time' ans=0 gets.to_i.times do a,b=gets.chomp.split a=Time.parse("2025-06-17 #{a}") b=Time.parse("2025-06-17 #{b}") b+=24*60*60 if b