#include <bits/stdc++.h>
using namespace std;
void online_judge() {}
long long powmod(long long x, long long n) {
  if (x == 0) return 0;
  if (n == 0) return 1;
  long long smallans = powmod(x, n / 2);
  long long ans = (smallans * smallans) % 1000000007;
  if (n & 1) ans = (ans * x) % 1000000007;
  return ans;
}
vector<bool> seive() {
  vector<bool> sv(1000001, 1);
  sv[0] = sv[1] = 0;
  for (long long i = 2; i * i <= 1000001; ++i) {
    if (sv[i])
      for (long long j = i * i; j <= 1000001; j += i) {
        sv[j] = 0;
      }
  }
  return sv;
}
long long gcd(long long a, long long b) {
  if (a < b) return gcd(b, a);
  if (b == 0) return a;
  return gcd(b, a % b);
}
struct triplet {
  long long x, y, gcd;
};
triplet extendedgcd(long long a, long long b) {
  if (b == 0) {
    triplet ans;
    ans.x = 1;
    ans.y = 0;
    ans.gcd = a;
    return ans;
  }
  triplet smallans = extendedgcd(b, a % b);
  triplet ans;
  ans.x = smallans.y;
  ans.y = (smallans.x - (a / b) * smallans.y);
  ans.gcd = smallans.gcd;
  return ans;
}
long long modinv(long long a, long long m) {
  if (gcd(a, m) != 1) return -1;
  return extendedgcd(a, m).x;
}
vector<long long> eulerphi() {
  vector<long long> phi(1000001, 0);
  for (int i = 0; i < 1000001; ++i) phi[i] = i;
  for (long long i = 2; i < 1000001; ++i) {
    if (phi[i] == i) {
      for (long long j = 2 * i; j < 1000001; j += i) {
        phi[j] = phi[j] * (i - 1);
        phi[j] /= i;
      }
      phi[i] -= 1;
    }
  }
  return phi;
}
void go() {
  long long a, b, p1, p2, p3, p4;
  cin >> p1 >> p2 >> p3 >> p4;
  cin >> a >> b;
  cout << max((long long)0,
              min(b - a + 1, min(p1, min(p2, min(p3, p4))) - min(a, b)));
}
int main() {
  cin.tie(0), ios_base ::sync_with_stdio(0);
  online_judge();
  go();
}
