#include <vector>
#include <iostream>
#include <list>
#include <algorithm>
using namespace std;
int p, q, r;
bool uslov(int N) {

	if ((N % p == 0 && N % q == 0)|| (N % p == 0 && N % r == 0)|| (N % r == 0 && N % q == 0))
		return true;
	else
		return false;
}

int main()
{

	unsigned long long L, R;
	long long count = 0;
	cin >> p >> q >> r >> L >> R;

	for (long long i = L; i <= R; i++) {
		if (uslov(i)) {
			count++;
		}
	}


	cout << count;
}