import sys sys.setrecursionlimit(10**6) class UnionFind(): def __init__(self, size): self.table = [-1 for _ in range(size)] self.size = [1 for _ in range(size)] def find(self, x): if self.table[x] < 0: return x else: self.table[x] = self.find(self.table[x]) return self.table[x] def unite(self, x, y): s1 = self.find(x) s2 = self.find(y) if s1 != s2: if self.table[s1] > self.table[s2]: self.table[s2] = s1 self.table[s1] -= 1 self.size[s1] += self.size[s2] self.size[s2] = 0 else: self.table[s1] = s2 self.table[s2] -= 1 self.size[s2] += self.size[s1] self.size[s1] = 0 return l, r = map(int, input().split()) uf = UnionFind(r+1) for i in range(l, r+1): for j in range(i*2, r+1, i): uf.unite(i, j) ans = -1 for i in range(l, r+1): if uf.table[i] < 0: ans += 1 print(ans)