#include <bits/stdc++.h>
using namespace std;
ifstream f("../data.in");
ofstream g("../data.out");
int main() {
  int n;
  cin >> n;
  if (n <= 2) {
    cout << 0;
    return 0;
  }
  long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int nTrain = 0;
  for (int i = 1; i < n - 1; i++)
    if (a[i] != a[0] && a[i] != a[n - 1]) nTrain++;
  cout << nTrain << endl;
  return 0;
}
