#include <bits/stdc++.h>
using namespace std;
int main() {
  int minn, nm, a, b;
  cin >> minn;
  for (int i = 0; i < 3; i++) {
    cin >> nm;
    minn = min(minn, nm);
  }
  cin >> a >> b;
  cout << max(0, min(b, minn - 1) - a + 1);
  return 0;
}
