#include <bits/stdc++.h>
using namespace std;
int ri() {
  int x;
  scanf("%d", &x);
  return x;
}
double rd() {
  double x;
  scanf("%lf", &x);
  return x;
}
long long rll() {
  long long x;
  scanf("%lld", &x);
  return x;
}
int main() {
  int mas[4];
  for (int i = (int)(0); i <= (int)(3); i++) mas[i] = ri();
  int a = ri(), b = ri();
  int ans = 0;
  for (int i = (int)(a); i <= (int)(b); i++) {
    int x = i;
    for (int j = (int)(0); j <= (int)(3); j++) x %= mas[j];
    if (x == i) ans++;
  }
  cout << ans;
  return 0;
}
