#include <bits/stdc++.h>
long long n10[10] = {1,      10,      100,      1000,      10000,
                     100000, 1000000, 10000000, 100000000, 1000000000};
using namespace std;
int a, b, p1, p2, p3, p4, s = 0;
int main() {
  cin >> p1 >> p2 >> p3 >> p4 >> a >> b;
  for (long long i = a; i <= b; i += 1)
    if (i == (((i % p1) % p2) % p3) % p4) s++;
  cout << s;
  return 0;
}
