#include <bits/stdc++.h>
using namespace std;
int s[4], vis[4];
int cnt = 0;
void dfs(int Now, int st) {
  int flag = 0;
  for (int i = 0; i < 4; i++) {
    if (vis[i]) continue;
    vis[i] = 1;
    flag = 1;
    dfs(Now % s[i], st);
    vis[i] = 0;
  }
  if (!flag) {
    if (Now == st) cnt++;
  }
}
int main() {
  int a, b;
  scanf("%d%d%d%d%d%d", &s[0], &s[1], &s[2], &s[3], &a, &b);
  int ans = 0;
  for (int i = a; i <= b; i++) {
    cnt = 0;
    for (int j = 0; j < 4; j++) {
      vis[j] = 1;
      dfs(i % s[j], i);
      vis[j] = 0;
    }
    if (cnt >= 7) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
