n=int(input());x=0 for _ in range(n): a,b=input().split() h,m=map(int,a.split(':'));s,t=map(int,b.split(':')) c=0;c=(s+24*(s1440)+1440*(c<0) print(x)