uses crt;
var x,i,n,max,min:integer;begin readln(n); read(x); max:=x; min:=x; for i:=1 to n-1 do begin readln(x); if min > x then min:=x; if max < x then max:=x; end; writeln(min,' ',max);
end.
uses crt;
var x,i,n,max,min:integer;
begin
readln(n);
read(x);
max:=x; min:=x;
for i:=1 to n-1 do
begin
readln(x);
if min > x then min:=x;
if max < x then max:=x;
end;
writeln(min,' ',max);
end.