#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int ar[n];
  int mmin = INT_MAX, mmax = INT_MIN, cnt = 0;
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
    if (ar[i] < mmin) mmin = ar[i];
    if (ar[i] > mmax) mmax = ar[i];
  }
  for (int i = 0; i < n; i++) {
    if (ar[i] != mmin && ar[i] != mmax) cnt++;
  }
  cout << cnt << endl;
}
