#include <bits/stdc++.h>
using namespace std;
int val[5];
int main() {
  int a, b, n, m, i, j, k, ans, sum, p1, p2, p3, p4, x;
  while (scanf("%d%d%d%d%d%d", &val[1], &val[2], &val[3], &val[4], &a, &b) !=
         EOF) {
    ans = 0;
    for (x = a; x <= b; x++) {
      sum = 0;
      string s = "1234";
      do {
        p1 = val[s[0] - '0'];
        p2 = val[s[1] - '0'];
        p3 = val[s[2] - '0'];
        p4 = val[s[3] - '0'];
        if ((((x % p1) % p2) % p3) % p4 == x) {
          sum++;
        }
        if (sum >= 7) {
          ans++;
          break;
        }
      } while (next_permutation(s.begin(), s.end()));
    }
    printf("%d\n", ans);
  }
  return 0;
}
