from collections import defaultdict class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1]*n self.rank = [0]*n def find(self, x): if self.parents[x] < 0: return x else: return self.find(self.parents[x]) def size(self, x): return -self.parents[self.find(x)] def union(self, x, y): x = self.find(x) y = self.find(y) if x == y: return if self.rank[x] < self.rank[y]: x, y = y, x self.parents[x] += self.parents[y] self.parents[y] = x if self.rank[x] == self.rank[y]: self.rank[x] += 1 def root(self): return [i for i in range(self.n) if self.parents[i] < 0] def allgroup_members(self): members = defaultdict(set) for m in range(self.n): members[self.find(m)].add(m) return members L, R = map(int, input().split()) n = R-L+1 uf = UnionFind(n) for i in range(L, R+1): for j in range(i, R+1, i): uf.union(i-L, j-L) D = uf.allgroup_members() print(len(D)-1)