#include <bits/stdc++.h>
using namespace std;
int p1, p2, p3, p4, a, b;
int ans = 0;
vector<int> g;
int f(int x) { return (((x % p1) % p2) % p3) % p4; }
int main() {
  cin >> p1 >> p2 >> p3 >> p4 >> a >> b;
  for (int i = a; i <= b; i++) {
    if (f(i) == i) ans++;
  }
  cout << ans << '\n';
}
