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