#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[4], x, y, flag = 0;
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> x >> y;
  sort(a, a + 4);
  for (int i = x; i <= y && i < a[0]; i++) {
    do {
      int ans = ((((i % a[0]) % a[1]) % a[2]) % a[3]);
      if (ans == i) {
        flag++;
        break;
      }
    } while (next_permutation(a + 1, a + 4));
  }
  cout << flag << endl;
  return 0;
}
