#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll MOD = 1e9+7;

ll p,q,r,x,y,c[4];


ll f(ll a){
    if(p==1)return 0LL;
    if(p>=4)return max(0LL,a-2LL);
    if(p==3){
        if(q==3){
            if(r==3)return a/3LL;
            else if(r==4){
                if(a<=2LL)return 0LL;
                if(a<=5LL)return 1LL;
                if(a<=7LL)return 2LL;
                if(a==8LL)return 3LL;
                if(a<=10LL)return 4LL;
                if(a==11LL)return 5LL;
                if(a<=13LL)return 6LL;
                return a-7;
            }else if(r==5||r==6){
                if(a<=2LL)return 0LL;
                if(a<=4LL)return 1LL;
                if(a==5LL)return 2LL;
                if(a<=7LL)return 3LL;
                return a-4LL;
            }else{
                if(a<=2LL)return 0LL;
                if(a<=4LL)return 1LL;
                return a-3LL;
            }
        }else if(q==4){
            if(r==4){
                if(a<=2LL)return 0LL;
                if(a==3LL)return 1LL;
                if(a<=5LL)return 2LL;
                return a-3LL;
            }else{
                return max(0LL,a-2LL);
            }
        }else{
            if(a<=2LL)return 0LL;
            return a-2LL;
        }
    }else if(p==2){
        if(q==2)return 0LL;
        if(q==3LL){
            if(r<=5)return 0LL;
            if(r==6)return a/6LL;
            if(r==7){
                if(a<=5LL)return 0LL;
                if(a<=11LL)return 1LL;
                if(a<=13LL)return 2LL;
                if(a<=17LL)return 3LL;
                if(a<=19LL)return 4LL;
                if(a==20LL)return 5LL;
                if(a<=23LL)return 6LL;
                if(a<=25LL)return 7LL;
                if(a==26LL)return 8LL;
                if(a==27LL)return 9LL;
                if(a<=29LL)return 10LL;
                if(a<=31LL)return 11LL;
                if(a==32LL)return 12LL;
                if(a==33LL)return 13LL;
                if(a==34LL)return 14LL;
                if(a==35LL)return 15LL;
                if(a<=37LL)return 16LL;
                if(a==38LL)return 17LL;
                if(a==39LL)return 18LL;
                if(a==40LL)return 19LL;
                if(a==41LL)return 20LL;
                if(a<=43LL)return 21LL;
                return a-22LL;
            }else if(r==8){
                if(a<=5LL)return 0LL;
                if(a<=7LL)return 1LL;
                if(a<=11LL)return 2LL;
                if(a<=13LL)return 3LL;
                if(a==14LL)return 4LL;
                if(a==15LL)return 5LL;
                if(a<=17LL)return 6LL;
                if(a<=19LL)return 7LL;
                if(a==20LL)return 8LL;
                if(a==21LL)return 9LL;
                if(a==22LL)return 10LL;
                if(a==23LL)return 11LL;
                if(a<=25LL)return 12LL;
                return a-13LL;
            }else if(r==9){
                if(a<=5LL)return 0LL;
                if(a<=7LL)return 1LL;
                if(a==8LL)return 2LL;
                if(a<=11LL)return 3LL;
                if(a<=13LL)return 4LL;
                if(a==14LL)return 5LL;
                if(a==15LL)return 6LL;
                if(a==16LL)return 7LL;
                if(a==17LL)return 8LL;
                if(a<=19LL)return 9LL;
                return a-10LL;
            }else{
                if(a<=5LL)return 0LL;
                if(a<=7LL)return 1LL;
                if(a==8LL)return 2LL;
                if(a==9LL)return 3LL;
                if(a<=11LL)return 4LL;
                if(a<=13LL)return 5LL;
                return a-8LL;
            }
        }else if(q==4){
            if(r==4)return a/4LL;
            else if(r==5){
                if(a<=3LL)return 0LL;
                if(a<=7LL)return 1LL;
                if(a<=9LL)return 2LL;
                if(a<=11LL)return 3LL;
                if(a<=13LL)return 4LL;
                if(a==14LL)return 5LL;
                if(a==15LL)return 6LL;
                if(a<=17LL)return 7LL;
                if(a==18LL)return 8LL;
                if(a==19LL)return 9LL;
                if(a<=21LL)return 10LL;
                return a-11LL;
            }else if(r==6){
                if(a<=3LL)return 0LL;
                if(a<=5LL)return 1LL;
                if(a<=7LL)return 2LL;
                if(a<=9LL)return 3LL;
                if(a==10LL)return 4LL;
                if(a==11LL)return 5LL;
                if(a<=13LL)return 6LL;
                return a-7LL;
            }else if(r==7||r==8){
                if(a<=3LL)return 0LL;
                if(a<=5LL)return 1LL;
                if(a==6LL)return 2LL;
                if(a==7LL)return 3LL;
                if(a<=9LL)return 4LL;
                return a-5LL;
            }else{
                if(a<=3)return 0LL;
                if(a<=5)return 1LL;
                return a-4LL;
            }
        }else if(q==5){
            if(r==5){
                if(a<=3LL)return 0LL;
                if(a==4LL)return 1LL;
                if(a<=7LL)return 2LL;
                if(a==8LL)return 3LL;
                if(a==9LL)return 4LL;
                if(a<=11LL)return 5LL;
                return a-6LL;
            }else if(r==6){
                if(a<=3LL)return 0LL;
                if(a==4LL)return 1LL;
                if(a==5LL)return 2LL;
                if(a<=7LL)return 3LL;
                return a-4LL;
            }else{
                if(a<=3)return 0LL;
                return a-3LL;
            }
        }else if(q==6){
            if(r==6){
                if(a<=3LL)return 0LL;
                if(a==4LL)return 1LL;
                if(a==5LL)return 2LL;
                if(a<=7LL)return 3LL;
                return a-4LL;
            }else{
                if(a<=3LL)return 0LL;
                return a-3LL;
            }
        }else{
            if(a<=3LL)return 0LL;
            return a-3LL;
        }
    }

}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin>>c[1]>>c[2]>>c[3]>>x>>y;
    sort(c+1,c+1+3);
    p=c[1];
    q=c[2];
    r=c[3];

    cout<<f(y)-f(x-1);
    return 0;
}