#include<stdio.h>
int main()
{
int h1 = 0, h2 = 0, m1 = 0, m2 = 0, s1 = 0, s2 = 0;
scanf("%d:%d:%d", &h1, &m1, &s1);
scanf("%d:%d:%d", &h2, &m2, &s2);
printf("%d", (h2 * 3600 + m2 * 60 + s2)-(h1 * 3600 + m1 * 60 +s1));
return 0;
}
#include<stdio.h>
int main()
{
int h1 = 0, h2 = 0, m1 = 0, m2 = 0, s1 = 0, s2 = 0;
scanf("%d:%d:%d", &h1, &m1, &s1);
scanf("%d:%d:%d", &h2, &m2, &s2);
printf("%d", (h2 * 3600 + m2 * 60 + s2)-(h1 * 3600 + m1 * 60 +s1));
return 0;
}