#include <iostream>
using namespace std;
int main() {
int m;
int n;
cin >> m;
cin >> n;
int a = min(m, n);
int b = max(m, n);
int ans = 0;
int x = a / 10000; //year;
int y = b / 10000;
int z = a / 100 % 100; //month
int w = b / 100 % 100;
int k = a % 100; //day
int p = b % 100;
int f[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
if (x == y) { //year equal;
if (x % 400 == 0 || (x % 4 == 0 && x % 100 != 0)) f[1] = 29;
if (z == w) { //day equal
ans = p - k + 1;
} else {
ans += f[z - 1] - k;
for (int i = z; i < w - 1; i++) {
ans += f[i];
}
ans += p + 1;
}
} else {
if (x % 400 == 0 || (x % 4 == 0 && x % 100 != 0))f[1] = 29; //run year
ans += f[z - 1] - k;
for (int i = z; i < 12; i++) {
ans += f[i];
}
for (int i = x + 1; i < y; i++) {
if (i % 400 == 0 || (i % 4 == 0 && i % 100 != 0))ans += 366;
else ans += 365;
}
f[1] = 28;
if (y % 400 == 0 || (y % 4 == 0 && y % 100 != 0)) f[1] = 29;
for (int i = 0; i < w - 1; i++)
ans += f[i];
ans += p + 1;
}
cout << ans << endl;
}
// 64 位输出请用 printf("%lld")