{
TASK:rprimes
LANG:PASCAL
}

Program rprimes;
  var a,b,i:longint;
      br:integer;
      Mas:array[1..10000] of longint;
begin
  readln(a,b);
    br:=0;
    i:=a;
    for i:=a to b do
     begin
    if (i mod 2 <> 0) or (i=2) then
      if (i mod 5 <> 0) or (i=5) then
      if (i mod 3 <> 0) or (i=3) then
      if (i mod 7 <> 0) or (i=7) then
      if (i mod 11 <> 0) or (i=11) then
      if (i mod 17 <> 0) or (i=17) then
      if (i mod 23 <> 0) or (i=23) then
        if (((i div 10) mod 2) <> 0) or (i<10) then
        if (((i div 100) mod 2) <> 0) or (i<100) then
        if (((i div 1000) mod 2) <> 0) or (i<1000) then
        if (((i div 10000) mod 2) <> 0) or (i<10000) then
        if (((i div 10) mod 3) <> 0) or (i<10) then
          if (((i div 100) mod 3) <> 0) or (i<100) then
          if (((i div 1000) mod 3) <> 0) or (i<1000) then
          if (((i div 10000) mod 3) <> 0) or (i<10000) then
          if (((i div 10) mod 7) <> 0) or (i<10) then
          if (((i div 100) mod 7) <> 0) or (i<100) then
          if (((i div 1000) mod 7) <> 0) or (i<1000) then
          if (((i div 10000) mod 7) <> 0) or (i<10000) then
               if (((i div 10) mod 11) <> 0) or (i<10) or (i=11)  then
          if (((i div 100) mod 11) <> 0) or (i<100) then
          if (((i div 1000) mod 11) <> 0) or (i<1000) then
          if (((i div 10000) mod 11) <> 0) or (i<10000) then
               if (((i div 10) mod 13) <> 0) or (i<10) or (i=13) then
          if (((i div 100) mod 13) <> 0) or (i<100) then
          if (((i div 1000) mod 13) <> 0) or (i<1000) then
          if (((i div 10000) mod 13) <> 0) or (i<10000) then
               if (((i div 10) mod 17) <> 0) or (i<10) or (i=17) then
          if (((i div 100) mod 17) <> 0) or (i<100) then
          if (((i div 1000) mod 17) <> 0) or (i<1000) then
          if (((i div 10000) mod 17) <> 0) or (i<10000) then
               if (((i div 10) mod 23) <> 0) or (i<10) or (i=23) then
          if (((i div 100) mod 23) <> 0) or (i<100) then
          if (((i div 1000) mod 23) <> 0) or (i<1000) then
          if (((i div 10000) mod 23) <> 0) or (i<10000) then






  inc(br);
  
      end;

      writeln(br);


      end.
