#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
int count, elem;
unsigned long long sum = 0;
vector<int> vec;
while (cin >> elem) vec.push_back((sum += elem, elem));
sort (vec.begin(), vec.end());
int i = 0;
while (vec[i] == vec[0]) sum-=vec[i++];
count = vec.size()-i;
int j = vec.size()-1;
while (vec[j] == vec[vec.size()-1]) sum-=vec[j--];
j = vec.size()-1 - j;
count -= j;
cout << sum / count + 1 * (sum % count >= count / 2.);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8dmVjdG9yPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgY291bnQsIGVsZW07Cgl1bnNpZ25lZCBsb25nIGxvbmcgc3VtID0gMDsKCXZlY3RvcjxpbnQ+IHZlYzsKCXdoaWxlIChjaW4gPj4gZWxlbSkgdmVjLnB1c2hfYmFjaygoc3VtICs9IGVsZW0sIGVsZW0pKTsKCXNvcnQgKHZlYy5iZWdpbigpLCB2ZWMuZW5kKCkpOwoJaW50IGkgPSAwOwoJd2hpbGUgKHZlY1tpXSA9PSB2ZWNbMF0pIHN1bS09dmVjW2krK107Cgljb3VudCA9IHZlYy5zaXplKCktaTsKCWludCBqID0gdmVjLnNpemUoKS0xOwoJd2hpbGUgKHZlY1tqXSA9PSB2ZWNbdmVjLnNpemUoKS0xXSkgc3VtLT12ZWNbai0tXTsKCWogPSB2ZWMuc2l6ZSgpLTEgLSBqOwoJY291bnQgLT0gajsKCWNvdXQgPDwgc3VtIC8gY291bnQgKyAxICogKHN1bSAlIGNvdW50ID49IGNvdW50IC8gMi4pOwoJcmV0dXJuIDA7Cn0=