#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define llint long long #define inf 1e18 #define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++) #define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++) #define chmin(x, y) (x) = min((x), (y)) #define chmax(x, y) (x) = max((x), (y)) using namespace std; typedef pair P; struct UnionFind{ int size; vector parent; UnionFind(){} UnionFind(int size){ this->size = size; parent.resize(size+1); init(); } void init(){ for(int i = 0; i <= size; i++) parent[i] = i; } int root(int i){ if(parent[i] == i) return i; return parent[i] = root(parent[i]); } bool same(int i, int j){ return root(i) == root(j); } void unite(int i, int j){ int root_i = root(i), root_j = root(j); if(root_i == root_j) return; parent[root_i] = root_j; } }; llint l, r; UnionFind uf(200005); set S; int main(void) { ios::sync_with_stdio(0); cin.tie(0); cin >> l >> r; for(int i = 1; i <= 200000; i++){ for(int j = i*2; j <= 200000; j+=i){ if(i >= l && i <= r && j >= l && j <= r) uf.unite(i, j); } } for(int i = l; i <= r; i++) S.insert(uf.root(i)); cout << (llint)S.size()-1 << endl; return 0; }