#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<long long> v;
  int count = 0;
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    v.push_back(a);
  }
  sort(v.begin(), v.end());
  for (int i = 1; i < n - 1; i++) {
    auto it = (lower_bound(v.begin(), v.end(), v[i]));
    long long p;
    if (it == v.begin()) {
      continue;
    } else {
      p = *(--it);
    }
    it = (upper_bound(v.begin(), v.end(), v[i]));
    long long n;
    if (it == v.end()) {
      continue;
    } else {
      n = *it;
    }
    if (n > v[i] && p < v[i]) {
      count++;
    }
  }
  cout << count;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
