package main import . "fmt" import "time" func main() { var n int Scan(&n) d:=0*time.Second const f="15:04" for ;n>0;n-- { var s,t string Scan(&s,&t) a,_:=time.Parse(f,s) b,_:=time.Parse(f,t) if b.Compare(a)<= 0 { b.AddDate(0,0,1) } d+=b.Sub(a) } Println(int64(d.Seconds())) }