#include <bits/stdc++.h>
using namespace std;
int ans[100005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  vector<int> v(4);
  int a, b;
  cin >> v[0] >> v[1] >> v[2] >> v[3] >> a >> b;
  int ans = 0;
  for (int i = (int)a; i <= (int)b; i++) {
    sort(v.begin(), v.end());
    ;
    int cnt = 0;
    do {
      if (i == ((((i % v[0]) % v[1]) % v[2]) % v[3])) {
        cnt++;
      }
      if (cnt >= 7) {
        ans++;
        break;
      }
    } while (next_permutation(v.begin(), v.end()));
  }
  cout << ans << "\n";
  return 0;
}
