#include <stdio.h>

int main() {
    int a, b;
    scanf("%d%d", &a, &b);

    int countA = (a - 1) / 4 - (a - 1) / 100 + (a - 1) / 400; // leap year from 1 to a
    int countB = b / 4 - b / 100 + b / 400;                   // leap year from 1 to b

    int result = countB - countA;                             //count how many leap year between a and b

    printf("%d", result);
    return 0;
}