#include using namespace std; struct UnionFind { vector par; vector sz; UnionFind(int n=0){ if(n>0) initialize(n); } void initialize(int n){ par.resize(n); sz.assign(n, 1); for(int i=0; i sz[y]) swap(x, y); par[x] = y; sz[y] += sz[x]; return true; } bool same(int x, int y){ return find(x) == find(y); } int size(int x){ return sz[find(x)]; } }; int main(){ int L, R; cin >> L >> R; UnionFind uf(R+1); for(int i=L; i<=R; i++) for(int j=2*i; j<=R; j+=i) uf.unite(i, j); int ans = -1; for(int i=L; i<=R; i++) if(uf.find(i) == i) ans++; cout << ans << endl; return 0; }