#include <bits/stdc++.h>
using namespace std;
const double f = 0.314159265352718281828459045;
const double eps = 1e-28;
int p[5];
int fun(int x) {
  int ans = x;
  for (int i = 1; i <= 4; i++) ans = ans % p[i];
  return (p[4] + ans) % p[4];
}
bool judge(int x) {
  int vnt = 0;
  sort(p + 1, p + 5);
  do {
    if (fun(x) == x) vnt++;
  } while (next_permutation(p + 1, p + 5));
  double pp = vnt * 1.0 / 24;
  if (pp - f >= eps) return true;
  return false;
}
int main() {
  int a, b, i, cnt = 0;
  for (i = 1; i <= 4; i++) scanf("%d", p + i);
  scanf("%d%d", &a, &b);
  for (i = a; i <= b; i++)
    if (judge(i)) cnt++;
  printf("%d\n", cnt);
  return 0;
}
