#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000;
const int MAX = 1000;
const int inf = 999999999;
const int p1 = 104393321, p2 = 104393329;
int p[MAX];
int f(int x, int v) {
  if (v == 4) return x;
  return f(x % p[v], v + 1);
}
int main() {
  ios::sync_with_stdio(0);
  for (int i = (0); i < int(4); ++i) cin >> p[i];
  int a, b;
  cin >> a >> b;
  int tot = 0;
  for (int i = (a); i < int(b + 1); ++i) {
    if (f(i, 0) == i) tot++;
  }
  cout << tot << endl;
  return 0;
}
