program eight;
var
n,l,r,i,j,m,k:longint;
a:array[1..5] of longint;
begin
assign(input,'eight.in');
assign(output,'eight.out');
reset(input);
rewrite(output);
readln(n);
for i:=1 to n do read(a[i]);
readln(l,r);
j:=1;
i:=l;
while (i>=l)and(i<=r) do
begin
if i mod 8=0 then
begin
k:=0;
for j:=1 to n do
if i mod a[j]=0 then k:=1;
if k=0 then m:=m+1;
end;
i:=i+1;
end;
writeln(m);
close(input);
close(output);
end.