#include <bits/stdc++.h>
using namespace std;
int np[4];
int a, b;
int p[4];
int per[4];
int f(int x) {
  for (int i = 0; i < 4; ++i) x = x % np[i];
  return x;
}
void init() {
  for (int i = 0; i < 4; ++i) cin >> p[i];
  cin >> a >> b;
  int ans = 0;
  for (int x = a; x <= b; ++x) {
    for (int i = 0; i < 4; ++i) per[i] = i;
    int now = 0;
    for (int k = 0; k < 24; ++k) {
      for (int i = 0; i < 4; ++i) np[i] = p[per[i]];
      if (f(x) == x) now++;
      next_permutation(per, per + 4);
    }
    if (now >= 7) ans++;
  }
  cout << ans << endl;
}
void york() {}
int main() {
  init();
  york();
  return 0;
}
