#include <iostream>
#include <vector>
using namespace std;
int countAnalogousArrays(vector<int> consecutiveDifference, int lowerBound, int upperBound) {
int n = consecutiveDifference.size();
int count = 0;
for (int startValue = lowerBound; startValue < upperBound; ++startValue) {
bool isValid = true;
int currentValue = startValue;
for (int i = 0; i < n; ++i) {
currentValue -= consecutiveDifference[i];
if (currentValue >= upperBound || currentValue < lowerBound) {
isValid = false;
break;
}
}
if (isValid) {
count++;
}
}
return count;
}
int main() {
int n;
cin >> n;
vector<int> consecutiveDifference(n);
for (int i = 0; i < n; ++i) {
cin >> consecutiveDifference[i];
}
int lowerBound, upperBound;
cin >> lowerBound >> upperBound;
int result = countAnalogousArrays(consecutiveDifference, lowerBound, upperBound);
cout << result << endl;
return 0;
}