//土尔逊Torson 编写于2023/2/9
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <iostream>

int year, year2, month, month2, day,
    day2; //定义第一个日期数据,和第二个日期数据
int year_1, year_2, year_3,
    year_4;//每次除以10再求10的余来取得在每一位上的数字 single dight
int month_1, month_2;
int day_1, day_2;
int number1, number2;

bool IsLeapYear(int year) { //计算得是否是闰年
    return (year % 400 == 0) || (year % 100 != 0 && year % 4 == 0);
}

int CountDay(int month, int day, int month_day[]) {//计算一年中有多少天
    int n = 0;
    for (int i = 0; i < month; ++i) {
        n += month_day[i];
    }
    n = n + day;
    return n;
}

void DayFormat(int
               number) {//把接受的数据转换成我们方便处理的数据
    day_2 = number % 10;
    day_1 = (number / 10) % 10;
    day2 = day_1 * 10 + day_2;
    month_2 = (number / 100) % 10;
    month_1 = (number / 1000) % 10;
    month2 = month_1 * 10 + month_2;
    year_4 = (number / 10000) % 10;
    year_3 = (number / 100000) % 10;
    year_2 = (number / 1000000) % 10;
    year_1 = (number / 10000000) % 10;
    year2 = year_1 * 1000 + year_2 * 100 + year_3 * 10 + year_4;
}

int NumOfYear(int
              year) {//如果是闰年则返回闰年天数,否则返回正常年的天数
    if (IsLeapYear(year)) {
        return 366;
    } else {
        return 365;
    }
}

int main() {
    int count_1 = 0, count_2 = 0;
    int month_day[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
    while (scanf("%d%d", &number1, &number2) != EOF) {
        DayFormat(number1);//整理第一个组数据
        //printf("year2 = %04d\n", year2);
        year = year2, month = month2, day = day2;
        DayFormat(number2);//整理第二个组数据
        //printf("year = %04d-%02d-%02d, year2 = %04d-%02d-%02d\n", year, month, day, year2, month2, day2);
        if (IsLeapYear(year)) {
            month_day[2] = 29;
        } else {
            month_day[2] = 28;
        }

        count_1 = CountDay(month, day,
                           month_day);//计数第一个数据一年中的天数

        if (IsLeapYear(year2)) {
            month_day[2] = 29;
        } else {
            month_day[2] = 28;
        }

        count_2 = CountDay(month2, day2,
                           month_day);//计数第二个数据一年中的天数

        //如果两个年份不相等有差值,则从小的年份往大的方向加以年为单位的天数
        int DifYear = 0;
        int tmpyear = 0;
        if (year2 != year) {
            DifYear = year2 - year;
            //printf("year = %04d, year2 = %04d, Difyear = %d\n", year, year2, DifYear);
            tmpyear = year;
            if (DifYear > 0) {
                for (tmpyear; tmpyear < year2; ++tmpyear) {
                    count_2 += NumOfYear(tmpyear);
                }
            } else {
                if (DifYear < 0) {
                    tmpyear = year2;
                    for (tmpyear; tmpyear < year; ++tmpyear) {
                        count_1 += NumOfYear(tmpyear);
                    }
                }
            }
        }
        //接下来显示差值
        int dif = count_1 - count_2;
        if (dif == 1 || dif == -1) {
            printf("%d\n", 2);
        } else {
            if (dif >= 0) {
                printf("%d\n", dif + 1);
            } else {
                printf("%d\n", - dif + 1);
            }
        }
        //printf("%d\n", day_1);
        //printf("%04d-%02d-%02d\n", year, month, day);
    }
    return EXIT_SUCCESS;
}
// 64 位输出请用 printf("%lld")