#include <iostream>
#include <vector>
using namespace std;
int countAnalogousArrays(vector<int> consecutiveDifference, int lowerBound, int upperBound) {
int n = consecutiveDifference.size();
int count = 0;
// Loop through all possible starting values within the given range
for (int startValue = lowerBound; startValue < upperBound; ++startValue) {
bool isValid = true;
int currentValue = startValue;
// Check if each value in the array is within bounds
for (int i = 0; i < n; ++i) {
currentValue -= consecutiveDifference[i];
// If the calculated value is out of bounds, break the loop
if (currentValue < lowerBound || currentValue >= upperBound) {
isValid = false;
break;
}
}
// If the array is valid, increment the count
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;
}