#include <bits/stdc++.h>
using namespace std;
int p[5];
int a, b;
int main() {
  int ans = 0;
  scanf("%d%d%d%d%d%d", &p[1], &p[2], &p[3], &p[4], &a, &b);
  for (int i = (a); i <= (b); ++i) {
    int cnt = 0;
    for (int j = (1); j <= (4); ++j) {
      for (int k = (1); k <= (4); ++k) {
        if (k != j) {
          for (int m = (1); m <= (4); ++m) {
            if (m != j && m != k) {
              for (int n = (1); n <= (4); ++n) {
                if (n != j && n != k && n != m) {
                  int tt = i % p[j] % p[k] % p[m] % p[n];
                  if (tt == i) cnt++;
                }
              }
            }
          }
        }
      }
    }
    if (cnt >= 7) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
