#include <bits/stdc++.h>
using namespace std;
int a[1000000];
int b[100000];
int main() {
  int n, m, i, j, k, l;
  while (cin >> n) {
    for (i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a, a + n);
    if (n <= 2)
      cout << "0" << endl;
    else {
      k = 0;
      for (i = n - 1;; i--) {
        if (a[n - 1] == a[i]) {
          k++;
        } else
          break;
      }
      for (i = 0;; i++) {
        if (a[0] == a[i]) {
          k++;
        } else
          break;
      }
      n = n - (k);
      if (n < 0) n = 0;
      cout << n << endl;
    }
  }
}
