#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, s = 0, min, max;
  vector<int> v;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> s;
    v.push_back(s);
  }
  s = 0;
  sort(v.begin(), v.end());
  for (i = 0; i < n; i++) {
    if ((v[i] != v[0]) && (v[i] != v[n - 1])) s++;
  }
  cout << s;
  return 0;
}
