#include <bits/stdc++.h>
using namespace std;
vector<int> nums;
bool check(int x) {
  int res = x;
  for (int k = 0; k < 4; k++) {
    res %= nums[k];
  }
  return (res == x ? true : false);
}
int main() {
  ios_base::sync_with_stdio(false);
  int a, b, c, d, L, R;
  cin >> a >> b >> c >> d >> L >> R;
  nums.push_back(a);
  nums.push_back(b);
  nums.push_back(c);
  nums.push_back(d);
  int cnt = 0;
  for (int k = L; k <= R; k++) {
    sort(nums.begin(), nums.end());
    if (check(k)) {
      cnt++;
      continue;
    }
    while (next_permutation(nums.begin(), nums.end())) {
      if (check(k)) {
        cnt++;
        break;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
