#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > p;
bool check(int x) {
  int cnt = 0;
  for (int i = 0; i < p.size(); i++)
    if ((((x % p[i][0]) % p[i][1]) % p[i][2]) % p[i][3] == x) cnt++;
  if (cnt >= 7) return true;
  return false;
}
vector<int> make_4_vector(int a, int b, int c, int d) {
  vector<int> tv(4);
  tv[0] = a;
  tv[1] = b;
  tv[2] = c;
  tv[3] = d;
  return tv;
}
int main() {
  int a, b;
  int pl[4];
  cin >> pl[0] >> pl[1] >> pl[2] >> pl[3] >> a >> b;
  for (int i = 0; i < 4; i++)
    for (int j = 0; j < 4; j++)
      if (j != i)
        for (int k = 0; k < 4; k++)
          if (k != i && k != j)
            for (int l = 0; l < 4; l++)
              if (l != i && l != j && l != k)
                p.push_back(make_4_vector(pl[0], pl[1], pl[2], pl[3]));
  int cnt = 0;
  for (int i = a; i <= b; i++)
    if (check(i)) cnt++;
  cout << cnt << '\n';
  return 0;
}
