function Main(input) {
	input = input.split("\n");
  	var n = parseInt(input[0], 10);
	a = input[1].split(" ");
  	var max = a[0];
  	var min = a[0];
  	for (var i=1; i<n; i++){
      if(a[i]>max){
       max=a[i]; 
      }else{
       if (a[i]<min){
         min=a[i];
       }
      }
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));