#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int p[4], a, b;
  cin >> p[0] >> p[1] >> p[2] >> p[3] >> a >> b;
  int m = min(p[0], p[1]);
  m = min(m, p[2]), m = min(m, p[3]);
  m = min(m, b);
  int ans = 0;
  for (int i = a; i <= m; i++) {
    int count = 0;
    for (int j = 0; j < 24; j++) {
      if (((((i % p[0]) % p[1]) % p[2]) % p[3]) == i) count++;
      if (count == 7) ans++;
      next_permutation(p, p + 4);
    }
  }
  cout << ans;
  return 0;
}
