#include <bits/stdc++.h>
using namespace std;
int x, y;
int a[5];
int c[50000];
int main() {
  for (int i = 0; i < 4; i++) cin >> a[i];
  cin >> x >> y;
  sort(a, a + 4);
  do {
    for (int i = x; i <= y; i++) {
      int j = i;
      for (int k = 0; k < 4; k++) j %= a[k];
      if (j == i) ++c[i];
    }
  } while (next_permutation(a, a + 4));
  int ans = 0;
  for (int i = x; i <= y; i++)
    if (c[i] >= 7) ans++;
  cout << ans << endl;
  return 0;
}
