#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, rej = 0;
  cin >> n;
  vector<int> a(n);
  for (size_t i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  for (int i = 0; i < n; i++)
    if (a[i] == a[0] || a[i] == a[n - 1]) rej++;
  cout << n - rej;
}
