{八 NOIP模拟2010-11-18
Author: yangbohua
Time: 2010-11-18}
program eight;
var
a:array[0..20] of longint;
n,i,j,s,t,temp,ans:longint;
bool:boolean;
begin
assign(input,'eight.in');
reset(input);
assign(output,'eight.out');
rewrite(output);
readln(n);
for i:=1 to n do
begin
read(a[i]);
if (a[i]=1) or (a[i]=2) or (a[i]=4) or (a[i]=8) then
begin
writeln(0);
close(input);
close(output);
halt;
end;
end;
readln(s,t);
temp:=(s div 8)*8;
if temp<s
then s:=temp+8;
t:=(t div 8)*8;
i:=s;
ans:=0;
while i<=t do
begin
bool:=true;
for j:=1 to n do
if (i>=a[j]) and (i mod a[j]=0) then
begin
bool:=false;
break;
end;
if bool then ans:=ans+1;
i:=i+8;
end;
writeln(ans);
close(input);
close(output)
end.