#include <vector>
#include <stdio.h>

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 int L, R;
	long long int count = 0;
	scanf("%d", &p); 
	scanf("%d", &q);
	scanf("%d", &r);
	scanf("%Ld", &L);
	scanf("%Ld", &R);
	for (unsigned long long i = L; i <= R; i++) {
		if (uslov(i)) {
			count++;
		}
	}


	printf("%Ld",count);
}