#include <bits/stdc++.h>
using namespace std;
int x, cnt = 0;
void comb(int arr[], int n, int index) {
  int i, j, tmp = x;
  if (index == n) {
    for (j = 0; j < n; j++) tmp = tmp % arr[j];
    if (tmp == x) cnt++;
    return;
  }
  for (i = index; i < n; i++) {
    swap(arr[i], arr[index]);
    comb(arr, n, index + 1);
    swap(arr[i], arr[index]);
  }
}
int main() {
  int p[4], a, b;
  cin >> p[0] >> p[1] >> p[2] >> p[3] >> a >> b;
  int ans = 0;
  for (x = a; x <= b; x++) {
    cnt = 0;
    comb(p, 4, 0);
    if (cnt >= 7) ans++;
  }
  cout << ans << endl;
  return 0;
}
