// // Created by zeronosu77108 on Jan 15, 2021. // #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<ostream &operator<<(ostream &o,const vector&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<> _par; vector_size; public: explicit UnionFind(const int n) : _par(n+1), _size(n+1, 1) {} int root(const int x) { if (!_par[x]) return x; _par[x] = root(_par[x].value()); return _par[x].value(); } bool is_same(const int x, const int y) { return root(x) == root(y); } bool merge(int x, int y) { x = root(x); y = root(y); if (x==y) return false; if (_size[x] < _size[y]) swap(x,y); _par[y] = x; _size[x] += _size[y]; return true; } int size(const int x) { return _size[x]; } }; int main() { int l, r; cin >> l >>r; unordered_map mp; UnionFind uni(2*100'000); for (int i=l; i<=r; i++) { for (int j=2*i; j<=r; j+=i) uni.merge(i, j); } long ans = 0; for (int i=l; i<=r; i++) { if (i == uni.root(i)) ans++; } cout << ans - 1 << endl; }