#include <bits/stdc++.h>
using namespace std;
int arr[9];
int a, b;
int main() {
  for (int i = 0; i < 4; i++) cin >> arr[i];
  cin >> a >> b;
  sort(arr, arr + 4);
  if (min(a, b) >= arr[0])
    cout << 0 << endl;
  else {
    if (max(a, b) >= arr[0])
      cout << arr[0] - min(a, b) << endl;
    else
      cout << abs(a - b) + 1 << endl;
  }
}
