#include <iostream>
using namespace std;
int main() {
int n, p;
cin>>p;
int min = 100;
int max = -100;
for (int i = 0; i < p; i++){
cin>>n;
if(n < min){
min = n;
}
if(n > max){
max = n;
}
}
cout<<min + max;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgbiwgcDsKCWNpbj4+cDsKCWludCBtaW4gPSAxMDA7CglpbnQgbWF4ID0gLTEwMDsKCWZvciAoaW50IGkgPSAwOyBpIDwgcDsgaSsrKXsKCQljaW4+Pm47CgkJaWYobiA8IG1pbil7CgkJCW1pbiA9IG47CgkJfQoJCWlmKG4gPiBtYXgpewoJCQltYXggPSBuOwoJCX0KCX0KCWNvdXQ8PG1pbiArIG1heDsKCXJldHVybiAwOwp9