#include <iostream>
using namespace std;

long a, b, n;
long num[30];
bool sum[30001];

int main (void) {
   cin >> n;
   for (int i = 0; i< n; ++i) {
      cin >> num[i];
   }
   cin >> a >> b;
   long res = 0;
   long max = num[0];
   sum[num[0]]= true;
   for (int i= 1; i< n; ++i) {
      for (int j= max; j > 0; --j) {
         if (sum[j]) {
            long pos = num[i] + j;
            if ((a <= pos) && (pos <= b) && (!sum[pos])) {
               res++;
            }
            sum[pos] = true;
         }
      }
      sum[num[i]] = true;
      if (max + num[i] <= b) {
         max+= num[i];
      }
   }
   cout << res;
   
   return(0);
}

