#include <iostream>
using namespace std;

int
main (int argc, const char *argv[])
{
  long long int p, q, r, L, R, sum = 0, i;
  cin >> p >> q >> r >> L >> R;
    
  for (i = L; i <= R; i++)
    {
     if ((i%p==0&&i%q==0)||(i%p==0&&i%r==0)||(i%q==0&&i%r==0))
         {
             sum++;
         }
    }
    

  cout << sum;

  return 0;
}