#include <iostream>
using namespace std;
int main() {
int count = 0, min, max, cmin = 1, cmax = 1, weight;
unsigned long long sum = 0;
cin >> min >> max;
if (min > max) swap(min, max);
while (cin >> weight) {
if (weight < min) {
sum += min*cmin;
min = weight;
count += cmin;
cmin = 1;
} else if (weight == min) cmin++;
else if (weight > max) {
sum += max*cmax;
max = weight;
count += cmax;
cmax = 1;
} else if (weight == max) cmax++;
else {
sum += weight;
count++;
}
}
cout << sum / count + 1 * (sum % count > count / 2);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgY291bnQgPSAwLCBtaW4sIG1heCwgY21pbiA9IDEsIGNtYXggPSAxLCB3ZWlnaHQ7Cgl1bnNpZ25lZCBsb25nIGxvbmcgc3VtID0gMDsKCWNpbiA+PiBtaW4gPj4gbWF4OwoJaWYgKG1pbiA+IG1heCkgc3dhcChtaW4sIG1heCk7Cgl3aGlsZSAoY2luID4+IHdlaWdodCkgewoJCWlmICh3ZWlnaHQgPCBtaW4pIHsKCQkJc3VtICs9IG1pbipjbWluOwoJCQltaW4gPSB3ZWlnaHQ7CgkJCWNvdW50ICs9IGNtaW47CgkJCWNtaW4gPSAxOwoJCX0gZWxzZSBpZiAod2VpZ2h0ID09IG1pbikgY21pbisrOwoJCWVsc2UgaWYgKHdlaWdodCA+IG1heCkgewoJCQlzdW0gKz0gbWF4KmNtYXg7CgkJCW1heCA9IHdlaWdodDsKCQkJY291bnQgKz0gY21heDsKCQkJY21heCA9IDE7CgkJfSBlbHNlIGlmICh3ZWlnaHQgPT0gbWF4KSBjbWF4Kys7CgkJZWxzZSB7CgkJCXN1bSArPSB3ZWlnaHQ7CgkJCWNvdW50Kys7CgkJfQoJfQoJY291dCA8PCBzdW0gLyBjb3VudCArIDEgKiAoc3VtICUgY291bnQgPiBjb3VudCAvIDIpOwoJcmV0dXJuIDA7Cn0=