#include <bits/stdc++.h>
using namespace std;
int solve(int m1, int m2, int m3, int m4, int a, int b) {
  int m = min(min(m1, m2), min(m3, m4));
  if (m <= a) return 0;
  if (m <= b) return m - a;
  return b - a + 1;
}
int main() {
  int p1, p2, p3, p4, a, b;
  scanf("%d %d %d %d %d %d", &p1, &p2, &p3, &p4, &a, &b);
  printf("%d\n", solve(p1, p2, p3, p4, a, b));
  return 0;
}
