#include<stdio.h> #include<stdlib.h>

int main(){ int n,i,j,k; while(scanf("%d",&n) != EOF){ int a[n]; for(k = 0;k < n;k++) a[k] = 0; for(i = 0;i < n;i++) scanf("%d",&a[i]); int min = 1000000,max = -1000000; for(j = 0;j < n;j++){ if(min > a[j]) min = a[j]; if(max < a[j]) max = a[j]; } printf("%d %d\n",max,min); } }