#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-7;
int p[5];
bool res[1005];
int a, b;
int main() {
  int i, j;
  for (i = (int)1; i <= (int)4; i++) scanf("%d", &p[i]);
  sort(p + 1, p + 5);
  scanf("%d %d", &a, &b);
  do {
    for (i = (int)a; i <= (int)b; i++) {
      int x = i;
      for (j = (int)1; j <= (int)4; j++) x = x % p[j];
      if (x == i) res[x]++;
    }
  } while (next_permutation(p + 1, p + 5));
  int hasil = 0;
  for (i = 0; i < (int)1005; i++)
    if (res[i]) hasil++;
  printf("%d\n", hasil);
}
