#include <bits/stdc++.h>
using namespace std;
int l, r, p[5], n[5], ans;
int get(int x) {
  int ans1 = 0;
  do {
    int cur = x;
    for (int i = 0; i < 4; ++i) cur %= p[n[i]];
    if (cur == x) ++ans1;
  } while (next_permutation(n, n + 4));
  return ans1;
}
int main() {
  for (int i = 0; i < 4; ++i) scanf("%d", p + i), n[i] = i;
  scanf("%d%d", &l, &r);
  for (int i = l; i <= r; ++i) {
    if (get(i) >= 7) {
      ans++;
    }
  }
  cout << ans;
  return 0;
}
