#include using namespace std; typedef long long int ll; typedef pair P; typedef vector VI; typedef vector VVI; const ll MOD = 1000000007; const ll INF = 4611686018427387903; #define REP(i, n) for (int i = 0; i < n; i++) #define ALL(v) v.begin(), v.end() VVI edge(214514, VI(0)); vector f(214514,0); void dfs(int v, int p) { for (auto to:edge[v]) { if (to!=p&&!f[to]){ f[to]=1; dfs(to, v); } } } int main(){ int l, r; cin >> l >> r; for(int i=l;i<=r;i++){ for(int j=i*2;j<=r;j+=i){ edge[i].push_back(j); edge[j].push_back(i); } } int ans=0; for(int i=l;i<=r;i++){ if(!f[i]){ ans++; f[i]=1; dfs(i,-1); } } cout << ans-1 << endl; return 0; }