program ba;
var
n,i,j,p,q,t:longint;
a:array[1..15]of longint;
biaozhi:boolean;
begin
assign (input,'eight.in');
reset (input);
assign (output,'eight.out');
rewrite (output);
readln (n);
for i:=1 to n do
read (a[i]);
readln;
readln (p,q);
for i:=p to q do
begin
if i mod 8 =0 then
begin
biaozhi:=false;
for j:=1 to n do
if i mod a[j]=0 then
begin
biaozhi:=true;
break
end;
if biaozhi=false then
t:=t+1
end
end;
writeln (t);
close (input);
close (output)
end.