c=0 for _ in'1'*int(input()): x,y,h,m=map(int,input().replace(':',' ').split()) if m