#include <iostream>
using namespace std;
int main() {
int a[100], max, min, n;
cin >> n;
max = 0;
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < n; i++) {
if (min > a[i]) {
min = a[i];
}
if (max < a[i]) {
max = a[i];
}
}
cout << max + min;
return 0;
}