#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 10, M = 1e6 + 50000, inf = 1e9 + 10, mod = 1000000007;
int a[N];
int f(int x) {
  for (int i = 1; i <= 4; i++) x %= a[i];
  return x;
}
int main() {
  int x, y, i, z, t;
  for (i = 1; i <= 6; i++) scanf("%d", &a[i]);
  int ans = 0;
  for (i = a[5]; i <= a[6]; i++) {
    if (i == f(i)) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
