#include <bits/stdc++.h>
using namespace std;
long long counter=0,p,q,r,L,R;
bool provera(long long n)
{
     int brojac = 0;
        if(n%p > 0)brojac++;
        if(n%q > 0)brojac++;
        if(n%r > 0)brojac++;
        if (((n/p)+(n/q)+(n/r)+brojac)<=n) return true;
        return false;
}
int main()
{
  cin>>p>>q>>r>>L>>R;
  for(int i=L,i<=R;i++)
  if(provera(i))counter++;
  cout<<counter;
}