# numpyチャレンジ import numpy as np class UnionFind: def __init__(self, n): self.par = np.array([i for i in range(n)]) self.size = np.ones(n) def find(self, v): if v == self.par[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)