#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#define ll long long
#define maxn 1000010
inline ll read()
{
    ll x=0; char c=getchar(),f=1;
    for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1;
    for(;'0'<=c&&c<='9';c=getchar())x=x*10+c-'0';
    return x*f;
}
inline void write(ll x)
{
    static int buf[20],len; len=0;
    if(x<0)x=-x,putchar('-');
    for(;x;x/=10)buf[len++]=x%10;
    if(!len)putchar('0');
    else while(len)putchar(buf[--len]+'0');
}
inline void writeln(ll x){write(x); putchar('\n');}
inline void writesp(ll x){write(x); putchar(' ');}
int p[maxn],mn[maxn],mu[maxn];
int l,r,tot;
void euler(int n)
{
    tot=0; mn[1]=0; mu[1]=1;
    for(int i=2;i<=n;i++){
        if(!mn[i])p[++tot]=i,mn[i]=tot,mu[i]=-1;
        for(int j=1;j<=mn[i]&&i*p[j]<=n;j++)
            mn[i*p[j]]=j,mu[i*p[j]]=(j==mn[i]?0:-mu[i]);
    }
    // for(int i=1;i<=n;i++)
    //     printf("%d %d %d\n",i,p[mn[i]],mu[i]);
}
ll solve(int n,int m)
{
    ll ans=(ll)n*m;
    for(int i=1;i<=n&&i<=m;i++)
        ans-=(ll)mu[i]*(n/i)*(m/i);
    for(int i=2;i<=n&&i<=m;i++)
        ans-=(n/i)+(m/i)-1;
    // printf("%d %d : %lld\n",n,m,ans);
    return ans;
}
int main()
{
    l=read(); r=read();
    euler(r);
    writeln(solve(r,r)-2*solve(l-1,r)+solve(l-1,l-1));
    return 0;
}
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ordered_set     tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
// find_by_order(k):    It returns to an iterator to the kth element (counting from zero) in the set
// order_of_key(k) :    It returns to the number of items that are strictly smaller than our item k
#define fast            ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb              push_back
#define f               first
#define s               second
#define F(i,a,b)        for(i=a;i<b;i++)
#define nl              "\n"
#define sp              " " 
#define all(c)          (c).begin(),(c).end()
#define rev(i,b,a)      for(int i=b;i>=a;i--)
#define iota            cout<<-1<<nl
#define cty             cout<<"YES"<<nl
#define ctn             cout<<"NO"<<nl
#define lmax            LLONG_MAX
#define lmin            LLONG_MIN
#define sz(v)           (v).size()
#define deci(n)         fixed<<setprecision(n)
#define c(x)            cout<<(x)
#define csp(x)          cout<<(x)<<" "
#define c1(x)           cout<<(x)<<nl
#define c2(x,y)         cout<<(x)<<" "<<(y)<<nl
#define c3(x,y,z)       cout<<(x)<<" "<<(y)<<" "<<(z)<<nl
#define c4(a,b,c,d)     cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<nl
#define c5(a,b,c,d,e)   cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<nl
#define c6(a,b,c,d,e,f) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<" "<<(e)<<" "<<(f)<<nl
typedef long double     ld;
typedef long long       ll;
typedef vector<ll>      vll;
typedef pair<ll,ll>     pll;
typedef vector<pll>     vpll;
const int mod=998244353;
const int mod1=1000000007;
const double pi=3.14159265358979323846264338327950288419716939937510582097494459230;
// priority_queue<t>
ll max(ll a , ll b){ if(a>b)return a; return b;}
ll min(ll a , ll b){ if(a<b)return a; return b;}
ll cdiv(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up
ll fdiv(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down
ll pct(ll x) { return __builtin_popcount(x); } // # of bits set
ll poww(ll a, ll b) { ll res=1; while(b) { if(b&1)	res=(res*a); a=(a*a); b>>=1; } return res; }
ll modI(ll a, ll m=mod) { ll m0=m,y=0,x=1;  if(m==1) return 0;  while(a>1)  { ll q=a/m; ll t=m;  m=a%m;  a=t; t=y; y=x-q*y;  x=t; } if(x<0) x+=m0; return x;}
ll powm(ll a, ll b,ll m=mod) {ll res=1;	while(b) {	if(b&1)	res=(res*a)%m;	a=(a*a)%m; b>>=1;	}	return res;}
//*******************************************************************************************************************************************//
ll pr[1000001]={0};

void go(){
    ll i,j;
 for(i=2;i<=1000000;i++)
 {
     if(pr[i])
         continue;
   pr[i]=i;
     for(j=i*i;j<=1000000;j+=i)
        pr[j]=i;
 }
}

void iamzeus()
{ ll i,j,x=0,y,ans=0,n,m,d,cnt=0,z,c=2,k;
  ll l,r,mult,bits;
 cin>>l>>r;
 vll v;
 for(i=max(l,2);i<=r;i++)
 {
     v.clear();
     d=i;
     while(d>1)
     {
         j=pr[d];
         v.pb(j);
         while(d%j==0)d/=j;
     }
         ll sum = 0;
    for (int msk=1; msk<(1ll<<v.size()); ++msk) {
        mult = 1,
            bits = 0;
        for ( z=0; z<(int)v.size(); ++z)
            if (msk & (1<<z)) {
                ++bits;
                mult *= v[z];
            }

        ll cur = (r / mult)-(i/mult)+(i%mult==0);
        if (bits % 2 == 1)
            sum += cur;
        else
            sum -= cur;
    }
    // c1(sum);
     mult=i;
     sum-=(r / mult)-(i/mult)+(i%mult==0);
     //c1(sum);
     ans+=sum*2;

 }
 c1(ans);
};
int main()
{fast;
    int t;
t=1;
 go();
//cin >>t;
 while(t--)
     iamzeus();
}
