#include <bits/stdc++.h>

using namespace std;
typedef unsigned long long ul;

ul ret(int n, vector<ul> pqr)
{
    if(n >= 3){
        if(pqr[0] == 1)
            return 0;
        else{
            if(pqr[0] == pqr[1] && pqr[1] == pqr[2]){
                if(pqr[0] == 2)
                    return 0;
                else{
                    if(pqr[0] == 3)
                        return n / 3;
                    else
                        return n - 2;
                }
            }else{
                if(pqr[0] == 2){
                    if(pqr[1] <= 6)
                        return 0;
                        return (n - 2);
                    }
            }
        }
    }
    return 0;
}

int main(void)
{
    ios_base::sync_with_stdio(false);
    ul p;
    vector<ul> pqr;
    for(int i = 0; i < 3; i++){
        scanf("%llu", &p);
        pqr.push_back(p);
    }
    sort(pqr.begin(), pqr.end());
    ul L, R;
    scanf("%llu %llu", &L, &R);
    printf("%llu", ret(R, pqr) - ret(L - 1, pqr));
}