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