#include<bits/stdc++.h>
using namespace std;
int p,q,r,n,L,R;
int br;
int main(){
p=2;
q=3;
r=7;
cin>>p;
cin>>q;
cin>>r;
cin>>L;
cin>>R;
for(int i=L;i<R;i++){
if(i%p==0 and i%q==0 and i%r==0 or i%p!=0 and i%q==0 and i%r==0 or i%p==0 and i%q!=0 and i%r==0 or i%p==0 and i%q==0 and i%r!=0){
    br++;
}
else{br+=0;}
}
cout<<br<<endl;
return 0;
}