#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.);
const int MOD = 1000 * 1000 * 1000 + 7;
int main() {
  int n;
  cin >> n;
  long long mn = 1000 * 1000 * 1111, mx = -1, cntmn = 0, cntmx = 0;
  long long t;
  for (int i = 0; i < n; ++i) {
    cin >> t;
    if (t == mn) {
      ++cntmn;
    }
    if (t == mx) {
      ++cntmx;
    }
    if (t < mn) {
      mn = t;
      cntmn = 1;
    }
    if (t > mx) {
      mx = t;
      cntmx = 1;
    }
  }
  if (mn == mx) {
    cout << "0\n";
    return 0;
  }
  cout << n - cntmn - cntmx << endl;
  return 0;
}
