#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
const int N=1000010;
int pr[N];
void sev(){
  pr[1]=1;
  for(int i=2; i<N; ++i){
    if(pr[i])
      continue;
    for(int j=i; j<N; j+=i){
      pr[j]=i;
    }
  }
}
int main(){
	ll l, r;
	scanf("%lld%lld",&l,&r);
	ll tmp, ans = 0;
	ll tmp1, cnt, tmp2, cnt1;
	sev();
	for(ll i=2; i<=r; ++i){
		tmp = (r/i*i - (l-1)/i*i)/i;
		cnt = 0;
		tmp1 = i;
		while(tmp1!=1){
			++cnt;
			tmp2 = pr[tmp1];
			cnt1 = 0;
			while(tmp1%tmp2==0){
				tmp1/=tmp2;
				++cnt1;
			}
			if(cnt1>1)break;
		}
		if(cnt1>1)continue;
		// cout<<i<<" "<<tmp<<" "<<cnt<<endl;
		if(cnt%2){
			ans += tmp*(tmp-1);
		}
		else{
			ans -= tmp*(tmp-1);
		}
	}
	// cout<<ans<<endl;
	for(int i=max(l,2ll); i<=r; ++i){
		tmp1 = (r)/i*i+i;
		// cout<<i<<" "<<tmp1<<endl;
		ans -= ((tmp1-i)/i-1)*2;
	}
	cout<<ans<<endl;
}
#include <bits/stdc++.h>
using namespace std;

signed  main(){
	int A, B, i, ans = 0;
	scanf("%d%d", &A, &B);
	for(i = 1; i <= B; i++){
		if(i * ((A + i - 1) / i) < i * (B / i)){
			ans = i;
		}
	}
	printf("%d\n", ans);
	return 0;
}