#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
const long long N = 1e2 + 1;
const long long mod = 1 << 30;
const long double eps = 1E-7;
char p;
int ans;
int a, b, c, x, y, z;
int m[12]{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
void swp() {
  swap(x, a);
  swap(y, b);
  swap(z, c);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> a >> p >> b >> p >> c;
  cin >> x >> p >> y >> p >> z;
  y--, b--;
  if (x < a)
    swp();
  else if (x > a)
    ;
  else if (y < b)
    swp();
  else if (y > b)
    ;
  else if (z < c)
    swp();
  while (x != a or y != b or z != c) {
    if (a == 2000 or (a % 4 == 0 and a % 100 != 0))
      m[1] = 29;
    else
      m[1] = 28;
    c++;
    if (c > m[b]) c = 1, b++;
    if (b == 12) b = 0, a++;
    ans = ans + 1;
  }
  cout << ans << endl;
}
