class UnionFind: def __init__(self, n): self.par = [i for i in range(n)] self.size = [1 for i in range(n)] def find(self, v): if self.par[v] == v: return v else: self.par[v] = self.find(self.par[v]) return self.par[v] def unite(self, u, v): u = self.find(u) v = self.find(v) if u == v: return if self.size[u] < self.size[v]: u, v = v, u self.size[u] += self.size[v] self.par[v] = u l, r = list(map(int, input().split())) uf = UnionFind(r + 1) for x in range(l, r + 1): y = x * 2 while y <= r: uf.unite(x, y) y += x ans = 0 for x in range(l, r): if uf.find(x) != uf.find(x + 1): ans += 1 uf.unite(x, x + 1) print(ans)