program gls;
var
k,i,j,n,a,b,max,lc:longint;
ss:array[1..15]of longint;
f,g:text;
function gcd(a,b:int64):int64;
var
t:longint;
begin
while a mod b <> 0 do
begin
t:=a mod b;
a:=b;
b:=t;
end;
gcd:=b;
end;
function lcm(a,b:int64):int64;
begin
lcm:= a*b div gcd(a,b);
end;
begin
assign(f,'eight.in');
reset(f);
assign(g,'eight.out');
rewrite(g);
readln(f,n);
for k:=1 to n do
read(f,ss[k]);
readln(f,a,b);
max:=trunc(b/8)-trunc(a/8);
lc:=1;
for k:=1 to n do
lc:=lcm(lc,ss[k]);
for k:=a to b do
if lc mod k=0 then dec(max);
writeln(g,max);
close(f);close(g);
end.