read(n);
for i:=1 to n do read(f[i,0]);
//初始化
for j:=1 to trunc(ln(n)/ln(2)) do
for i:=1 to n-(1 shl j)+1 do
f[i,j]:=min(f[i,j-1],f[i+(1 shl(j-1)),j-1]);
//查询[x,y]区间内的min
k:=trunc(ln(y-x+1)/ln(2));
exit( min(f[x,k],f[y-(1 shl k)+1,k] );
for i:=1 to n do read(f[i,0]);
//初始化
for j:=1 to trunc(ln(n)/ln(2)) do
for i:=1 to n-(1 shl j)+1 do
f[i,j]:=min(f[i,j-1],f[i+(1 shl(j-1)),j-1]);
//查询[x,y]区间内的min
k:=trunc(ln(y-x+1)/ln(2));
exit( min(f[x,k],f[y-(1 shl k)+1,k] );