#include using namespace std; typedef long long ll; class UnionFind { public: vector table, num; UnionFind(){} UnionFind(int size){ table.resize(size, -1); num.resize(size, 1); } int find(int x){ if (table[x] < 0) return x; else { table[x] = find(table[x]); return table[x]; } } bool same(int x, int y) { return find(x) == find(y); } bool is_root(int x){ if (table[x] < 0) return true; else return false; } ll get_size(int x){ return num[find(x)]; } void unite(int x, int y){ int r1 = find(x); int r2 = find(y); if (r1 != r2) { if (table[r1] > table[r2]){ table[r2] = r1; table[r1]--; num[r1] += num[r2]; num[r2]--; } else { table[r1] = r2; table[r2]--; num[r2] += num[r1]; num[r1]--; } } return; } }; int main() { int l, r; cin >> l >> r; UnionFind uf(r-l+1); for (int i = l; i < r+1; ++i) { for (int j = 2*i; j < r+1; j += i) { uf.unite(i-l, j-l); } } int ans = -1; for (int i = 0; i < r-l+1; ++i) { if (uf.is_root(i)) ans++; } cout << ans << endl; return 0; }