#include <bits/stdc++.h>
using namespace std;
int main() {
  int p1, p2, p3, p4, a, b;
  while (cin >> p1 >> p2 >> p3 >> p4 >> a >> b) {
    int ans = 0;
    for (int x = a; x <= b; ++x) {
      int fx = (((x % p1) % p2) % p3) % p4;
      if (fx == x) {
        ++ans;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
