#include <bits/stdc++.h>
using namespace std;
int inf = 2e9;
int mod = 1e9 + 7;
long double PI = 3.1415926536;
int p1, p2, p3, p4, a, b;
bool f(int x) { return x == (((x % p1) % p2) % p3) % p4; }
int main() {
  int res = 0;
  cin >> p1 >> p2 >> p3 >> p4 >> a >> b;
  for (int i = a; i <= b; i++) {
    res += f(i);
  }
  cout << res;
  return 0;
}
