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