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