#include <bits/stdc++.h>
using namespace std;
const int M = 1e4 + 10;
int p[10];
int main() {
  for (int i = 1; i <= 4; i++) cin >> p[i];
  int a, b;
  cin >> a >> b;
  int ans = 0;
  for (int i = a; i <= b; i++) {
    int t = i;
    for (int j = 1; j <= 4; j++) t %= p[j];
    if (t == i) ans++;
  }
  cout << ans;
}
