#include <bits/stdc++.h>
using namespace std;
int h[20] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
bool check(int i) {
  if ((i % 4 == 0) && (i % 100 != 0 || i % 400 == 0))
    return true;
  else
    return false;
}
int main() {
  ifstream inf("input.txt");
  int n, k = 1, r = 0, g = 0, q = 1000, g1 = 0, r1 = 0, e = 0, e1 = 0, a, f = 0,
         u;
  string s, s1;
  cin >> s >> s1;
  for (int i = 0; i <= 3; i++) {
    g += (int(s[i]) - 48) * q;
    q = int(q / 10);
  }
  q = 1000;
  for (int i = 0; i <= 3; i++) {
    g1 += (int(s1[i]) - 48) * q;
    q = int(q / 10);
  }
  r = (int(s[5]) - 48) * 10 + (int(s[6]) - 48);
  r1 = (int(s1[5]) - 48) * 10 + (int(s1[6]) - 48);
  e = (int(s[8]) - 48) * 10 + (int(s[9]) - 48);
  e1 = (int(s1[8]) - 48) * 10 + (int(s1[9]) - 48);
  if (g1 < g || (g1 == g && r1 < r) || (g1 == g && r1 == r && e1 < e)) {
    u = g;
    g = g1;
    g1 = u;
    u = r;
    r = r1;
    r1 = u;
    u = e;
    e = e1;
    e1 = u;
  }
  for (int i = g + 1; i <= g1 - 1; i++)
    if (check(i)) f++;
  if (check(g) && r <= 2 && (g1 > g || r1 > 2)) f++;
  if (check(g1) && r1 > 2 && g1 != g) f++;
  a = (g1 - g) * 365 + ((h[r1 - 1] + e1) - (h[r - 1] + e)) + f;
  cout << abs(a);
}
