#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, x, c1, c2, mi = 1e9 + 1, mx = -1;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (x <= mi) {
      if (x == mi)
        c1++;
      else
        mi = x, c1 = 1;
    }
    if (x >= mx) {
      if (x == mx)
        c2++;
      else
        mx = x, c2 = 1;
    }
  }
  if (mx == mi)
    cout << 0;
  else
    cout << n - c1 - c2 << endl;
}
