#include <bits/stdc++.h>
using namespace std;
int p1, p2, p3, p4, a, b;
int main() {
  scanf("%d %d %d %d %d %d", &p1, &p2, &p3, &p4, &a, &b);
  int rec = 0;
  for (int i = a; i <= b; i++) {
    int x = i;
    x %= p1;
    x %= p2;
    x %= p3;
    x %= p4;
    if (x == i) rec++;
  }
  printf("%d", rec);
  return 0;
}
