#include <bits/stdc++.h>
using namespace std;
struct Date {
  int d, m, y;
};
const int monthDays[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int countLeapYears(Date d) {
  int years = d.y;
  if (d.m <= 2) years--;
  return years / 4 - years / 100 + years / 400;
}
int getDifference(Date dt1, Date dt2) {
  long int n1 = dt1.y * 365 + dt1.d;
  for (int i = 0; i < dt1.m - 1; i++) n1 += monthDays[i];
  n1 += countLeapYears(dt1);
  long int n2 = dt2.y * 365 + dt2.d;
  for (int i = 0; i < dt2.m - 1; i++) n2 += monthDays[i];
  n2 += countLeapYears(dt2);
  return (n2 - n1);
}
int main() {
  string s, f;
  cin >> s >> f;
  Date dt1 = {0, 0, 0};
  Date dt2 = {0, 0, 0};
  dt1.y = (int)(s[0] - '0') * 1000 + (int)(s[1] - '0') * 100 +
          (int)(s[2] - '0') * 10 + (int)(s[3] - '0');
  dt1.m = (int)(s[5] - '0') * 10 + (int)(s[6] - '0');
  dt1.d = (int)(s[8] - '0') * 10 + (int)(s[9] - '0');
  dt2.y = (int)(f[0] - '0') * 1000 + (int)(f[1] - '0') * 100 +
          (int)(f[2] - '0') * 10 + (int)(f[3] - '0');
  dt2.m = (int)(f[5] - '0') * 10 + (int)(f[6] - '0');
  dt2.d = (int)(f[8] - '0') * 10 + (int)(f[9] - '0');
  cout << abs(getDifference(dt1, dt2)) << endl;
  return 0;
}
