#include <bits/stdc++.h> using namespace std; int main(){ int n; while (scanf("%d", &n)!=EOF){ vector<int> a; for (int i=0; i<n; i++) { int t; scanf("%d", &t); a.push_back(t); } int max_value = *max_element(a.begin(), a.end()); int min_value = *min_element(a.begin(), a.end()); printf("%d %d\n", max_value, min_value); } return 0; }