#include <bits/stdc++.h>
using namespace std;
int p[4];
int a, b;
int ord[77][4];
int c = 0;
int main() {
  for (int i = 0; i < (int)(4); ++i) scanf("%d", p + i);
  scanf("%d%d", &a, &b);
  for (int i = 0; i < (int)(4); ++i)
    for (int j = 0; j < (int)(4); ++j)
      for (int k = 0; k < (int)(4); ++k)
        for (int t = 0; t < (int)(4); ++t) {
          if (i == j || i == k || i == t || j == k || j == t || k == t)
            continue;
          ord[c][0] = i;
          ord[c][1] = j;
          ord[c][2] = k;
          ord[c][3] = t;
          ++c;
        }
  assert(c == 24);
  int ans = 0;
  for (int x = a; x <= b; ++x) {
    int cnt = 0;
    for (int c = 0; c < (int)(24); ++c) {
      int i = ord[c][0];
      int j = ord[c][1];
      int k = ord[c][2];
      int t = ord[c][3];
      if (x % p[i] % p[j] % p[k] % p[t] == x) {
        ++cnt;
      }
    }
    if (cnt >= 7) ++ans;
  }
  printf("%d\n", ans);
  return 0;
}
