#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n], i;
  set<long long> s;
  map<long long, long long> m;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    m[a[i]]++;
    s.insert(a[i]);
  }
  if (s.size() <= 2) {
    cout << 0 << endl;
    return (0);
  }
  sort(a, a + n);
  cout << n - m[a[0]] - m[a[n - 1]] << endl;
}
