#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  t = 1;
  while (t--) {
    int p, q, r, s, a, b;
    cin >> p >> q >> r >> s >> a >> b;
    p = min(p, q);
    p = min(p, r);
    p = min(p, s);
    if (p > b)
      cout << b - a + 1 << endl;
    else if (p > a)
      cout << min(b, p) - a << endl;
    else
      cout << "0" << endl;
  }
  return 0;
}
