#include <bits/stdc++.h>
using namespace std;
int u[5], p[5], rez[5], sum, a, b;
void f(int v) {
  int i, s;
  if (v == 4) {
    s = a;
    for (i = 0; i < 4; i++) s %= p[rez[i]];
    if (s == a) sum++;
  } else
    for (i = 0; i < 4; i++)
      if (u[i] == 0) {
        u[i] = 1;
        rez[v] = i;
        f(v + 1);
        u[i] = 0;
      }
}
bool check() {
  sum = 0;
  f(0);
  if (sum > 6) return 1;
  return 0;
}
int main() {
  int i, k = 0;
  for (i = 0; i < 4; i++) cin >> p[i];
  cin >> a >> b;
  while (a <= b) {
    if (check()) k++;
    a++;
  }
  cout << k;
  return 0;
}
