#include <bits/stdc++.h>
using namespace std;
int A, B, P[4], result, cnt[32000];
int main() {
  for (int i = 0; i < 4; i++) cin >> P[i];
  cin >> A >> B;
  sort(P, P + 4);
  do {
    for (int i = A; i <= B; i++)
      if (i % P[0] % P[1] % P[2] % P[3] == i) cnt[i]++;
  } while (next_permutation(P, P + 4));
  for (int i = A; i <= B; i++)
    if (cnt[i] > 6) result++;
  cout << result << endl;
  return 0;
}
