#include <bits/stdc++.h>
using namespace std;
const int R = 1000, N = 31415;
int r[N + 1], p[4];
int Mod(int x) { return x % p[0] % p[1] % p[2] % p[3]; }
int main() {
  int a, b, t1, t2, t;
  while (cin >> p[0] >> p[1] >> p[2] >> p[3] >> a >> b) {
    memset(r, 0, (N + 1) * sizeof(int));
    t1 = p[0] < p[1] ? p[0] : p[1];
    t2 = p[2] < p[3] ? p[2] : p[3];
    t = t1 < t2 ? t1 : t2;
    int count = 24;
    while (count--) {
      for (int i = a; i <= b; ++i) {
        if (i < t) {
          if (Mod(i) == i) ++r[i];
        } else
          break;
      }
      next_permutation(p, p + 4);
    }
    count = 0;
    for (int i = a; i <= b; ++i)
      if (r[i] >= 7) ++count;
    cout << count << endl;
  }
}
