#include<bits/stdc++.h>
using namespace std;
int main(){
int n,a,b,c=1,d=0;
cin>>n>>b;
c=n;
while(b>=c){
a=c;
if(a%6==0 or a%8==0){
d++;
}
c++;
}
cout<<d;
}
/**************************************************************
Problem: 1982
User: lvrenxiang
Language: C++
Result: Accepted
Time:8 ms
Memory:2072 kb
****************************************************************/