var
n,i,j,k,a,b,tot:longint;
d:array[0..16]of longint;
fg:boolean;
begin
assign(input,'eight.in');reset(input);
assign(output,'eight.out');rewrite(output);
readln(n);
for i:=1 to n do read(d[i]);
readln(a,b);
{for i:=1 to n-1 do
for j:=i+1 to n do
if d[i]>d[j] then
begin k:=d[i];d[i]:=d[j];d[j]:=d[i]; end; }
tot:=0;
for i:=a to b do
begin
fg:=true;
if i mod 8<>0 then fg:=false;
if fg then
for j:=1 to n do
if (i mod d[j]=0)
then begin fg:=false;break;end;
if fg then inc(tot);
end;
writeln(tot);
close(input);close(output);
end.