#include <bits/stdc++.h>
using namespace std;
int p[4];
int ori[4] = {0, 1, 2, 3};
int perm[4];
bool f(const int &x) {
  memcpy(perm, ori, sizeof(ori));
  int temp = 0, i, xx;
  do {
    xx = x;
    for (i = 0; i < 4; ++i) {
      xx %= p[perm[i]];
    }
    if (xx == x) ++temp;
  } while (next_permutation(perm, perm + 4) && temp < 7);
  return temp > 6;
}
int main() {
  int a, b;
  scanf("%d%d%d%d%d%d", &p[0], &p[1], &p[2], &p[3], &a, &b);
  int ans = 0;
  for (int i = a; i <= b; ++i)
    if (f(i)) ++ans;
  printf("%d\n", ans);
}
