import java.util.Scanner; public class pre { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(),sum = 0,H,M,h,m; for(int i=0;im){ sum = sum + (60-M) + 23*60 + m; System.out.println(sum); } else if(h==H && M