#include
using namespace std;
int imax(int array[], int count)
{
int max;
if (count == 0)
return array[count];
else
{
max = imax(array, count - 1);
if (max < array[count - 1])
return array[count - 1];
else
return max;
}
}
int imin(int array[], int count)
{
int min;
if (count == 0)
return array[count];
else
{
min = imin(array, count - 1);
if (min > array[count - 1])
return array[count - 1];
else
return min;
}
}
int main()
{
int count;
cin >> count;
int *p = new int[count];
for (int i = 0; i < count; i++)
{
cin >> p[i];
}
cout << imax(p, count) << endl;
cout << imin(p, count) << endl;
return 0;
}