#include <iostream>

int main()
{
    int a,b;
    while (true){
        std::cin >> a >> b;
        if (a == 0 && b == 0){
            break;
}       std::cout << (b / 4) - ((a - 1) / 4) - (b / 100) + ((a - 1) / 100) + (b / 400) - ((a - 1) / 400) << std::endl;
}
    return 0;
}