#include <bits/stdc++.h>
using namespace std;
int n, k = 0;
char str[100];
vector<string> v_bt;
string tmp;
bool color[100];
void bt(int indx) {
  int i, j, k;
  if (indx == n) {
    tmp.clear();
    for (k = 0; k < 4; k++) tmp += str[k];
    v_bt.push_back(tmp);
    return;
  }
  for (i = 1; i <= n; i++) {
    if (!color[i]) {
      str[indx] = i + '0';
      color[i] = true;
      bt(indx + 1);
      color[i] = false;
    }
  }
}
bool chk(int x, int p1, int p2, int p3, int p4) {
  int ans = (x % p1);
  ans %= p2;
  ans %= p3;
  ans %= p4;
  if (ans == x) return true;
  return false;
}
int main(void) {
  n = 4;
  bt(0);
  int a, b, p1, p2, p3, p4, i, count, tot, j;
  int p[5];
  while (scanf("%d %d %d %d %d %d", &p[0], &p[1], &p[2], &p[3], &a, &b) == 6) {
    for (i = a, count = 0, tot = 0; i <= b; i++) {
      for (j = 0, count = 0; j < 24; j++) {
        if (chk(i, p[v_bt[j][0] - '1'], p[v_bt[j][1] - '1'],
                p[v_bt[j][2] - '1'], p[v_bt[j][3] - '1'])) {
          count++;
        }
      }
      if (count >= 7) tot++;
    }
    printf("%d\n", tot);
  }
  return 0;
}
