#include <bits/stdc++.h>
using namespace std;
int c;
bool f[50000];
int main() {
  int p[4], l, r;
  cin >> p[0] >> p[1] >> p[2] >> p[3] >> l >> r;
  sort(p, p + 4);
  for (int i = l; i <= r; i++) {
    do {
      if ((((i % p[0]) % p[1]) % p[2]) % p[3] == i && f[i] == false) {
        c++;
        f[i] = true;
      }
    } while (next_permutation(p, p + 4));
  }
  cout << c;
  return 0;
}
