#include <bits/stdc++.h>
using namespace std;
int a, b, p[4];
int f(int x) {
  int r = x;
  for (int i = 0; i < 4; i++) {
    r %= p[i];
  }
  return r;
}
int main() {
  for (int i = 0; i < 4; i++) cin >> p[i];
  cin >> a >> b;
  int c[b - a + 1];
  memset(c, 0, sizeof(c));
  sort(p, p + 4);
  do {
    for (int i = 0; i <= b - a; i++) {
      int x = i + a;
      if (x == f(x)) {
        c[i]++;
      }
    }
  } while (next_permutation(p, p + 4));
  int cc = 0;
  for (int i = 0; i <= b - a; i++) {
    if (c[i] >= 7) {
      cc++;
    }
  }
  cout << cc << endl;
  return 0;
}
