#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const double eps = 1e-9;
const double pi = acos(-1.0);
int pr[4];
int p[4];
int get(int x) {
  for (int i = 0; i < 4; i++) p[i] = i;
  int ans = 0;
  do {
    int cur = x;
    for (int i = 0; i < 4; i++) {
      cur %= pr[p[i]];
    }
    if (cur == x) ans++;
  } while (next_permutation(p, p + 4));
  return ans;
}
int main() {
  for (int i = 0; i < 4; i++) scanf("%d", pr + i);
  int a, b;
  scanf("%d%d", &a, &b);
  int ans = 0;
  for (int i = a; i <= b; i++) {
    if (get(i) >= 7) ans++;
  }
  cout << ans << endl;
  return 0;
}
