#include <bits/stdc++.h>
using namespace std;
bool arr[1000000];
void getprim() {
  arr[0] = 1;
  arr[1] = 1;
  int i;
  long long j;
  for (i = 2; i < 1000000; i++) {
    if (arr[i] == 0) {
      for (j = i, j = j * i; j < 1000000; j += i) {
        arr[j] = 1;
      }
    }
  }
}
int n, v[1005], i, j, p, k;
int main() {
  int i, j, arr[4], cot, ans = 0, a, b;
  scanf("%d %d %d %d %d %d", &arr[0], &arr[1], &arr[2], &arr[3], &a, &b);
  for (i = a; i <= b; i++) {
    int num = 0;
    for (cot = 0; cot < 24; cot++) {
      next_permutation(arr, arr + 4);
      if ((((i % arr[0]) % arr[1]) % arr[2]) % arr[3] == i) num++;
    }
    if (num >= 7) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
