#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) { return x == 0 ? y : gcd(y % x, x); }
long long lcm(long long x, long long y) { return x / gcd(x, y) * y; }
int fx[] = {1, -1, 0, 0};
int fy[] = {0, 0, 1, -1};
bool prime[25000];
vector<int> v;
void siev() {
  for (int i = 4; i <= 20001; i += 2) prime[i] = true;
  for (int i = 2; i * i <= 20001; i++) {
    if (!prime[i]) {
      for (int j = i * i; j <= 20001; j += i) prime[j] = 1;
    }
  }
  v.push_back(2);
  for (int i = 3; i <= 20001; i += 2) {
    if (!prime[i]) {
      v.push_back(i);
    }
  }
}
int main() {
  int n, k = 0, ans = 0, a[5], b, c, per[25][5];
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> b >> c;
  sort(a, a + 4);
  do {
    for (int j = 0; j < 4; j++) {
      per[k][j] = a[j];
    }
    k++;
  } while (next_permutation(a, a + 4));
  for (int i = b; i <= c; i++) {
    int m = i, cnt = 0;
    for (int j = 0; j < 24; j++) {
      m = i;
      for (int k = 0; k < 4; k++) {
        m = m % per[j][k];
      }
      if (m == i) cnt++;
      if (cnt >= 7) {
        ans++;
        break;
      }
    }
  }
  printf("%d", ans);
  return 0;
}
