#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

float r,p,q;
long long R,L;
long long sol;

int main (){
    cin >> p >> r >> q >> L >> R;
    if (p == 1 or q == 1 or r == 1){
        cout << 0 << endl;
        return 0;
    }
    if (p > r) swap(p,r);
    if (r > q) swap(r,q);
    if (p > r) swap(p,r);

    if (p == 3 and r == 4 and q == 5) {
        if (L > 3) cout << R-L << endl;
        else cout << R-2 << endl;
        return 0;
    }
    for (long long i = L; i <= R; i++){
        if ((ceil(i*1.0/p) + ceil(i*1.0/r) + ceil(i*1.0/q)) <= i){
            sol++;
        }
    }
    cout << sol << endl;
    return 0;
}