#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  vector<int> p(4);
  for (int i = 0; i < 4; i++) cin >> p[i];
  vector<vector<int> > pers;
  for (int i = 0; i < 24; i++) {
    pers.push_back(p);
    next_permutation(p.begin(), p.end());
  }
  cin >> a >> b;
  int res = 0;
  for (int i = a; i <= b; i++) {
    int c = 0;
    for (int j = 0; j < 24; j++) {
      if (((((i % pers[j][0]) % pers[j][1]) % pers[j][2]) % pers[j][3]) == i)
        c++;
    }
    if (c >= 7) res++;
  }
  cout << res;
  return 0;
}
