#include <bits/stdc++.h>
using namespace std;
void nandini() {
  unsigned long n, i, j, k, e = 0, d = 0;
  cin >> n;
  if (n == 1 || n == 2)
    cout << 0;
  else {
    unsigned long a[n];
    for (i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n);
    for (i = 0; i < n; i++) {
      if (a[i] != a[0] && a[i] != a[n - 1]) d++;
    }
    cout << d;
  }
}
int main() {
  unsigned long t = 1;
  while (t--) {
    nandini();
  }
  return 0;
}
