Var
   a,b,i,j,m,n,p,t: longint;
   d: array [1..30] of longint;
   s: array [1..30000] of boolean;

Begin
     readln(input, n);
     for i:= 1 to n-1 do
         read(input, d[i]);
     readln(input, d[n]);
     readln(input, a, b);
     t:= 0;
     m:= d[1];
     s[d[1]]:= true;
     for i:= 2 to n do
         begin
         for j:= m downto 1 do
             if s[j] then
                begin
                p:= j + d[i];
                if (a <= p) and (p <= b) and (not s[p]) then
                   Inc(t);
                s[p]:= true;
                end;
         s[d[i]]:= true;
         if (m + d[i] <= b) then
            Inc(m, d[i]);
         end;
     writeln(output, t);
End.
