#include <fstream>
using namespace std;
ifstream f1("bai3_17.inp");
ofstream f2("bai3_17.out");
long n,a[100],bn = 100000000,ln = 0;
int main()
{
    f1 >> n;
    for (long i = 0; i < n; i++)
    {
        f1 >> a[i];
        if (a[i] > ln) ln = a[i];
        if (a[i] < bn) bn = a[i];
    }
    f2 << ln+bn;
    return 0;
}
