#include <iostream>
using namespace std;


int GetMonthDay(int y, int m)
{
    int month[] = { 0, 31, 28, 31, 30, 31, 30, 31,31, 30, 31, 30, 31 };
    if (m == 2 && ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0))
        return 29;
    return month[m];
}


class Date
{
public:
    Date(int year = 0, int month = 0, int day = 0)
        :_year(year),
        _month(month),
        _day(day)
    {}

    friend Date GetDate(int n);

    bool operator<(Date& d)
    {
        if (_year < d._year)
            return true;
        else if (_year == d._year && _month < d._month)
            return true;
        else if (_year == d._year && _month == d._month && _day < d._day)
            return true;
        return false;
    }
    bool operator==(Date& d)
    {
        return _year == d._year &&
            _month == d._month &&
            _day == d._day;
    }
    bool operator!=(Date& d)
    {
        return !(*this == d);
    }
    Date& operator++()
    {
        _day++;
        if (_day > GetMonthDay(_year, _month))
        {
            _month++;
            _day = 1;
            if (_month == 13)
            {
                _month = 1;
                _year++;
            }
        }
        return *this;
    }

    int operator-(Date& d)
    {
        Date max = *this;
        Date min = d;
        if (max < min)
        {
            max = min;
            min = *this;
        }
        int n = 0;
        while (max != min)
        {
            ++min;
            n++;
        }
        return n;
    }

private:
    int _year;
    int _month;
    int _day;
};

Date GetDate(int n)
{
    Date d;
    d._year = n / 10000;
    d._day = n % 100;
    d._month = (n - d._year * 10000) / 100;
    return d;
}



int main() {
    int n1, n2;
    while (cin >> n1 >> n2) { 

        Date d1 = GetDate(n1);
        Date d2 = GetDate(n2);
        cout << d1 - d2 + 1 << endl;
    }
}