#include <bits/stdc++.h>
using namespace std;
int main() {
  int p[4], a, b;
  cin >> p[0] >> p[1] >> p[2] >> p[3] >> a >> b;
  int ret = 0;
  for (int i = a; i <= b; i++) {
    int q[] = {0, 1, 2, 3};
    int qtd = 0;
    do {
      int k = i;
      for (int j = 0; j < 4; j++) {
        k %= p[q[j]];
      }
      if (k == i) {
        qtd++;
      }
    } while (next_permutation(q, q + 4));
    ret += qtd >= 7;
  }
  cout << ret << endl;
  return 0;
}
