def find(x): if data[x] < 0: return x data[x] = find(data[x]) return data[x] def union(x, y): x, y = find(x), find(y) if x == y: return if data[x] > data[y]: x, y = y, x data[x] += data[y] data[y] = x L, R = map(int, input().split()) MAX = 2 << 17 data = [0] * MAX for i in range(L, R + 1): data[i] = -1 for u in range(L, R + 1): for v in range(2 * u, R + 1, u): union(u, v) print(len(list(filter(lambda x: x < 0, data))) - 1)