#pragma GCC optimize("Ofast") #include #include #include using namespace std; using namespace __gnu_pbds; using ll = long long; using ull = unsigned long long; using pii = pair; using pll = pair; #define rep(i, n) for(int i = 0; i < (n); ++i) #define all(x) (x).begin(),(x).end() constexpr char ln = '\n'; constexpr long long MOD = 1000000007LL; //constexpr long long MOD = 998244353LL; template inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; } template inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; } //////////////////////////////////////////////////////////////////////////////////////////////////////////// struct UnionFind { vector node; UnionFind() = default; UnionFind(int x) {init(x);} void init(int x) { node.assign(x,-1); } bool merge(int x, int y) { x = root(x); y = root(y); if (x == y) return false; if (node[x] > node[y]) swap(x,y); node[x] += node[y]; node[y] = x; return true; } bool same(int x, int y) { return root(x) == root(y); } int root(int x) { if (node[x] < 0) return x; return node[x] = root(node[x]); } int size(int x) { return -node[root(x)]; } }; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int L,R; cin >> L >> R; UnionFind uf(R-L+1); for (int i = L; i <= R; i++) { for (int j = 2; j*i <= R; j++) { uf.merge(i-L,j*i-L); } } set dic; rep(i,R-L+1) { dic.emplace(uf.root(i)); } cout << dic.size()-1 << ln; }