import java.util.Scanner; public class Main { public static void main(String args[]){ Scanner sc=new Scanner(System.in); int n=Integer.parseInt(sc.nextLine()),begin,end,sum=0; String s[]; int are[]=new int[4]; for(int i=0;iare[2] || (are[0]==are[2] && are[1]>are[3])) are[2]+=24; begin=are[0]*60+are[1]; end=are[2]*60+are[3]; sum+=(end-begin); } System.out.println(sum); } }