#include <bits/stdc++.h>
using namespace std;
int *c;
int main() {
  int a, b, t, f, n, m, d, g, sum = 0;
  int mas[4];
  cin >> mas[0] >> mas[1] >> mas[2] >> mas[3] >> a >> b;
  c = min_element(mas, mas + 4);
  *c = min(*c, b + 1);
  if (*c - a >= 0)
    cout << *c - a;
  else
    cout << "0";
}
