#include <iostream>
using namespace std;
int main() {
long long sum = 0, kM = 0, km = 0, n = 0;
int mass = 0, M = 0, m = 0;
while(cin >> mass){
if(n == 0){
M = mass;
m = mass;
km = 1;
kM = 1;
}
else{
if(mass > M){
M = mass;
kM = 1;
}
else if(mass == M) kM++;
if(mass < m){
m = mass;
km = 1;
}
else if(mass == m) km++;
}
sum += mass;
n++;
}
n == kM + km? cout << 0 : cout << (2*(sum-kM*M-km*m)+n-kM-km)/(2*(n-kM-km));
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CgkKCWxvbmcgbG9uZyBzdW0gPSAwLCBrTSA9IDAsIGttID0gMCwgbiA9IDA7CglpbnQgbWFzcyA9IDAsIE0gPSAwLCBtID0gMDsKCgl3aGlsZShjaW4gPj4gbWFzcyl7CgkJaWYobiA9PSAwKXsKCQkJTSA9IG1hc3M7CgkJCW0gPSBtYXNzOwoJCQlrbSA9IDE7CgkJCWtNID0gMTsKCQl9CgkJZWxzZXsKCQkJaWYobWFzcyA+IE0pewoJCQkJTSA9IG1hc3M7CgkJCQlrTSA9IDE7CgkJCX0JCgkJCWVsc2UgaWYobWFzcyA9PSBNKSBrTSsrOwoJCQkKCQkJaWYobWFzcyA8IG0pewoJCQkJbSA9IG1hc3M7CgkJCQlrbSA9IDE7CgkJCX0KCQkJZWxzZSBpZihtYXNzID09IG0pIGttKys7CgkJfQoJCXN1bSArPSBtYXNzOwoJCW4rKzsKCX0KCW4gPT0ga00gKyBrbT8gY291dCA8PCAwIDogY291dCA8PCAoMiooc3VtLWtNKk0ta20qbSkrbi1rTS1rbSkvKDIqKG4ta00ta20pKTsKCXJldHVybiAwOwp9