#include <bits/stdc++.h>
using namespace std;
int p[4], sol;
int f(int x) { return (((x % p[0]) % p[1]) % p[2]) % p[3]; }
int main() {
  int a, b;
  scanf("%d %d %d %d %d %d", &p[0], &p[1], &p[2], &p[3], &a, &b);
  for (int i = a; i <= b; ++i) {
    sort(p, p + 4);
    int num = 0;
    do {
      if (f(i) == i) ++num;
    } while (next_permutation(p, p + 4));
    if (num > 6) ++sol;
  }
  printf("%d\n", sol);
  return 0;
}
