#include <bits/stdc++.h>
using namespace std;
ifstream f1("bai3_17.INP");
    ofstream f2("bai3_17.OUT");
    int a[10000];
int main()
{ int n,i,min=2e9,max=-2e9;
f1>>n;
for (i=1;i<=n;i++)
{f1>>a[i];
if (min>a[i]) {min=a[i];}
if (max<a[i]) {max=a[i];}
}
f2<<max+min;
}
