#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, count = 0;
  cin >> n;
  int ar[n];
  for (i = 0; i < n; ++i) cin >> ar[i];
  int mi = *(min_element(ar, ar + n));
  int ma = *(max_element(ar, ar + n));
  for (i = 0; i < n; ++i) {
    if (mi != ar[i] && ma != ar[i]) ++count;
  }
  cout << count << "\n";
  return 0;
}
