#include <bits/stdc++.h>
using namespace std;
const int INF = 100000000;
const double EPS = 1e-8;
int p1, p2, p3, p4, p5, a, b;
int f(int x) { return ((((x % p1) % p2) % p3) % p4); }
int main() {
  for (; ~scanf("%d %d %d %d %d %d", &p1, &p2, &p3, &p4, &a, &b);) {
    int r = 0;
    for (int i = a; i < b + 1; ++i) {
      int t = f(i);
      if (i == t) r++;
    }
    printf("%d\n", r);
  }
  return 0;
}
