#include <stdio.h> int main(){ int N; while (scanf("%d", &N) != EOF){ long long num[N]; scanf("%lld", &num[0]); long long max = num[0]; long long min = num[0]; for (int i = 1; i < N; ++i) { scanf("%lld", &num[i]); if (num[i] > max){ max = num[i]; } if (num[i] < min){ min = num[i]; } } printf("%lld %lld\n", max, min); } return 0; }