import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] str = br.readLine().split(" "); br.close(); int num = Integer.parseInt(str[0]) - 1; int len = Integer.parseInt(str[1]); long count = 0; if (num * 2 <= len) { count += len - num * 2 + 1; } int i,j; for (i = 3; num * i <= len; i += 2) { boolean flag = true; for (j = 3; j * j <= i; j += 2) { if (i % j == 0) { flag = false; break; } } if (flag) { count += len - num * i + 1; } } System.out.println(count); } }