#include <bits/stdc++.h>
using namespace std;
vector<int> p(4);
bool t(int n) {
  int v = 0, end = 1;
  for (vector<int> c = p; end; end = next_permutation(p.begin(), p.end()))
    v += n == n % p[0] % p[1] % p[2] % p[3];
  return v >= 7;
}
int main() {
  int a, b, v = 0;
  cin >> p[0] >> p[1] >> p[2] >> p[3] >> a >> b;
  sort(p.begin(), p.end());
  for (int i = a; i <= b; i++) v += t(i);
  cout << v;
  return 0;
}
