#include <iostream>
using namespace std;
int main()
{
int n, vect[256];
cin >> n;
for (int index = 0; index < n; index++)
cin >> vect[index];
int minim = vect[0], maxim = vect[0];
for (int index = 1; index < n; index++) {
if (vect[index] < minim)
minim = vect[index];
if (vect[index] > maxim)
maxim = vect[index];
}
cout << minim << ' ' << maxim;
return 0;
}