#include<stdio.h>
int main()
{
	int n,i,num;
	int max=-1000000000,min=1000000000;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&num);
		if(num>max)max=num;
		if(num<min)min=num;
	}
	printf("%d %d",max,min);
	
	return 0;
}
