#include<iostream> using namespace std; int main(){ int x1,y1,x2,y2,x,y,n,e,f; cin>>x1>>y1>>x2>>y2; x=x1*60+y1; y=x2*60+y2; n=y-x; cout<<n; return 0; }