#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, e_min = INT_MAX, e_max = INT_MIN;
  list<int> l;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> x;
    if (x < e_min) e_min = x;
    if (x > e_max) e_max = x;
    l.push_back(x);
  }
  l.remove_if(
      [e_min, e_max](int it) { return (it == e_min) || (it == e_max); });
  cout << l.size();
}
