#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long n, long long m) {
  if (n == 0) return 1;
  if (n & 1) {
    return (a * (power(a, n / 2, m) * power(a, n / 2, m)) % m) % m;
  }
  return (power(a, n / 2, m) * power(a, n / 2, m)) % m;
}
long long maxi(string a, string b) {
  if (a.length() > b.length()) {
    string t = a;
    a = b;
    b = a;
  }
  int b1[b.length()];
  memset(b1, -1, sizeof(b));
  for (int i = 0; i < a.length(); i++) {
    for (int j = 0; j < b.length(); j++)
      if (a[i] == b[j]) {
        b1[j] = i;
      }
  }
  int c = 0, ma = -1, p = -1;
  for (int i = 0; i < a.length(); i++) {
    c = 0;
    for (int j = 0; j < b.length(); j++) {
      if (p == -1 && b1[j] == i) {
        p = i;
        c = 1;
        continue;
      }
      if (b1[j] > p) {
        p = b1[j];
        c++;
      }
      ma = max(ma, c);
    }
  }
  return ma;
}
int main() {
  long long t, n, k, ar[200005];
  t = 1;
  while (t--) {
    long long p1, p2, p3, p4, a, b;
    cin >> p1 >> p2 >> p3 >> p4 >> a >> b;
    p1 = min(p1, min(p2, min(p3, p4)));
    if (p1 <= b)
      cout << max((long long)0, p1 - a);
    else
      cout << b - a + 1;
  }
  return 0;
}
