https://www.acmicpc.net/problem/10818
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int arr[] = new int[N];
for (int i = 0; i < N; i++) {
arr[i] = sc.nextInt();
}
Arrays.sort(arr);
sc.close();
System.out.println(arr[0] + " " + arr[N - 1]);
}
}