#include #include #include #include using namespace std; int main() { int h1, m1, h2, m2, n; int sleep = 0; cin >> n; for(int i=0; i h2){ h1 -= 24; } if(m2 < m1){ sleep -= 60; } sleep += ((60 - m1) + m2)%60; sleep += (h2 - h1)*60; } cout << sleep << endl; return 0; }