program eight;
var
n,a,b,i,j,ans,p:longint;
sz:array[0..20]of longint;
begin
assign(input,'eight.in');
assign(output,'eight.out');
reset(input);
rewrite(output);
readln(n);
for i:=1 to n do
read(sz[i]);
readln;
readln(a,b);
for i:=1 to n-1 do
for j:=i+1 to n do
if sz[i]>sz[j] then begin
sz[0]:=sz[i];
sz[i]:=sz[j];
sz[j]:=sz[0];
end;
i:=(a div 8)*8;
if i<a then i:=i+8;
ans:=0;
while i<=b do
begin
p:=0;
for j:=1 to n do
if i mod sz[j]=0 then begin
p:=1;
break;
end;
if p=0 then ans:=ans+1;
i:=i+8;
end;
writeln(ans);
close(input);
close(output);
end.