#include<iostream>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn=4641590;
const int mod=1000010;
ll mu[maxn],prime[maxn];
int vis[maxn];
ll key[mod],val[mod],head[mod],nxt[mod];
int tot=0;
struct hash{
int tt;
void init()
{
memset(head,-1,sizeof(head));
tt=0;
}
ll inst(ll x,ll y)
{
int k=x%mod;
key[tt]=x;
val[tt]=y;
nxt[tt]=head[k];
head[k]=tt++;
}
ll finda(ll x)
{
int k=x%mod;
for(int i=head[k];i!=-1;i=nxt[i])
{
if(key[i]==x)
{
return val[i];
}
}
return -1;
}
}hs;
ll calu(ll x)
{
if(x<maxn)
{
return mu[x];
}
if(hs.finda(x)!=-1)
{
return hs.finda(x);
}
ll ans=1;
for(ll l=2,r;l<=x;l=r+1)
{
r=x/(x/l);
ans-=calu(x/l)*(r-l+1);//分块
}
hs.inst(x,ans);
return ans;
}
void init()
{
mu[1]=1;
for(int i=2;i<maxn;i++)
{
if(!vis[i])
{
prime[++tot]=i;
mu[i]=-1;
}
for(int j=1;j<=tot&&i*prime[j]<maxn;j++)
{
vis[i*prime[j]]=1;
if(i%prime[j]) mu[i*prime[j]]=-mu[i];
else
{
mu[i*prime[j]]=0;
break;
}
}
}
for(int i=1;i<maxn;i++)
{
mu[i]+=mu[i-1];
}
}
int main()
{
init();
hs.init();
ll a,b;
cin>>a>>b;
cout<<calu(b)-calu(a-1)<<endl;
}