#include <bits/stdc++.h>
using namespace std;
const int INF = (int)2e9;
const double PI = (double)acos(-1.0);
const double EPS = (double)1e-9;
const long long MOD = (long long)1e9 + 7;
int a, b, c, d;
inline int f(int x) { return (((x % a) % b) % c) % d; }
int main() {
  int x, y, res = 0;
  scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &x, &y);
  for (int i = x; i <= y; i += 1)
    if (f(i) == i) res++;
  printf("%d\n", res);
  return 0;
}
