#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:134217728")
using namespace std;
int main() {
  int p[4], a, b;
  for (int i(0); i <= (4 - 1); ++i) scanf("%d", &p[i]);
  scanf("%d%d", &a, &b);
  int res(0);
  for (int i = a; i <= b; ++i) {
    int perm[] = {0, 1, 2, 3};
    int k(0);
    do {
      if (((((i % p[perm[0]]) % p[perm[1]]) % p[perm[2]]) % p[perm[3]]) == i)
        ++k;
    } while (next_permutation(perm, perm + 4));
    if (k >= 7) ++res;
  }
  printf("%d\n", res);
  return 0;
}
