#include #include #include #include #include #include #include using namespace std; typedef long long ll; bool ok[200005]; struct UnionFind { vector data; UnionFind(int size) : data(size, -1) { } bool unionSet(int x, int y) { x = root(x); y = root(y); if (x != y) { if (data[y] < data[x]) swap(x, y); data[x] += data[y]; data[y] = x; } return x != y; } bool findSet(int x, int y) { return root(x) == root(y); } int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); } int size(int x) { return -data[root(x)]; } }; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; 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++){ uf.unionSet(i, i*j); } } set st; for(int i = L; i <= R; i++){ st.insert(uf.root(i)); } cout << st.size()-1 << endl; }