#include <bits/stdc++.h>

/*

Kvalifikacije 2019/2020.
Treci krug kvalifikacija

Aphelion, Vuk Markovic
Zadatak A: Upoznavanje
2, 3, 6, delioci 6
2, 3, 7, upto 100
2, 3, 8, upto 100
2, 3, 9, upto 100
2, 3, 10, upto 100
2, 4, 4, delioci 4
2, 4, 5, upto 100
2, 4, 6, upto 100
2, 4, 7, upto 100
2, 4, 8, upto 100
2, 4, 9, upto 100
2, 4, 10, upto 100
2, 5, 5, upto 100
... upto 100
3, 3, 3, delioci 3 sta
*/
// 8..20
// floor(20/4) - floor(7/4)

using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    long long l, r;
    double p[3];
    cin >> p[0] >> p[1] >> p[2] >> l >> r;
    sort(p, p+3);
    if (p[0] < 2)
    {
       cout << 0;
       return 0;
    }
    else if (p[0] == 2 && p[1] == 2)
    {
       cout << 0;
       return 0;
    }
    else if (p[0] == 2 && p[1] == 3 && p[2] <= 5)
    {
       cout << 0;
       return 0;
    }
    if (p[0] == 2 && p[1] == 3 && p[2] == 6)
    {
        cout << floor(r/6) - max((double)0, floor( (l-1) / 6 ));
        return 0;
    } else if (p[0] == 2 && p[1] == 4 && p[2] == 4)
    {
        cout << floor(r/4) - max((double)0, floor( (l-1) / 4));
        return 0;
    } else if (p[0] == 3 && p[1] == 3 && p[2] == 3)
    {
        cout << floor(r/3) - max((double)0, floor( (l-1) / 3));
        return 0;
    } else {
        long long izbrojiN = 0;
        if (r <= 100)
        {
            for (long long i = l; i <= r; i++) {
               if (ceil(i/p[0]) + ceil(i/p[1]) + ceil(i/p[2]) <= i)
                  izbrojiN += 1;
            }
            cout << izbrojiN;
            return 0;
        }
        for (long long i = l; i <= 100; i++) {
               if (ceil(i/p[0]) + ceil(i/p[1]) + ceil(i/p[2]) <= i)
                  izbrojiN += 1;
        }
        cout << izbrojiN + ((long long)(r) - 100);
        return 0;
    }
}