N=int(input()) ans=0 for _ in range(N): sleep,awake=input().split() sH,sM=map(int,sleep.split(':')) aH,aM=map(int,awake.split(':')) # print(sH,sM,aH,aM) if aH