#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int i, a, b, x, y, count, res;
  vector<int> v(4);
  int p[24][4];
  for (i = 0; i < 4; ++i) cin >> v[i];
  cin >> a >> b;
  sort(v.begin(), v.end());
  i = 0;
  do {
    for (int j = 0; j < 4; ++j) p[i][j] = v[j];
    ++i;
  } while (next_permutation(v.begin(), v.end()));
  res = 0;
  for (x = a; x <= b; ++x) {
    count = 0;
    for (i = 0; i < 24; ++i) {
      y = (((x % p[i][0]) % p[i][1]) % p[i][2]) % p[i][3];
      if (y == x) count++;
    }
    if (count >= 7) res++;
  }
  cout << res << endl;
  return 0;
}
