#include <bits/stdc++.h>
using namespace std;
bool f(vector<int> &num, int x);
int main(int argc, char **argv) {
  vector<int> num(4);
  int a = 0, b = 0;
  for (int i = 0; i < 4; ++i) {
    cin >> num[i];
  }
  cin >> a >> b;
  int count = 0, numz = 0;
  for (int i = a; i <= b; ++i) {
    vector<int> z(num);
    for (int j = 0; j < 24; ++j) {
      cout << endl;
      if (f(z, i)) {
        count++;
      }
      if (count >= 7) {
        numz++;
        count = 0;
        break;
      }
      std::next_permutation(z.begin(), z.end());
    }
  }
  cout << numz;
  return 0;
}
bool f(vector<int> &num, int x) {
  int l = x;
  for (int i = 0; i < 4; ++i) {
    l %= num[i];
  }
  return (x == l) ? true : false;
}
