#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
static const double EPS = 1e-5;
template <class T>
inline T sqr(T x) {
  return x * x;
}
template <typename T, typename U>
T lexical_cast(const U& src) {
  T tmp;
  stringstream ss;
  ss << src;
  ss >> tmp;
  return tmp;
}
int main() {
  vector<int> p(4);
  int a, b;
  for (int i = 0; i < 4; i++) cin >> p[i];
  sort(p.begin(), p.end());
  int ret = 0;
  for (cin >> a >> b; a <= b; a++) {
    int c = 0;
    do {
      int tmp = a;
      for (int i = 0; i < 4; i++) tmp %= p[i];
      if (a == tmp) c++;
    } while (next_permutation(p.begin(), p.end()));
    if (c >= 7) ret++;
  }
  cout << ret << endl;
  return 0;
}
