#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
void solve() {
  int n;
  cin >> n;
  map<int, int> M;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    M[x]++;
  }
  auto ip = M.begin();
  int ans = n;
  ans -= ip->second;
  if (M.size() > 1) {
    ip = M.end();
    ip--;
    ans -= ip->second;
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tests = 1;
  int t = 1;
  while (tests--) {
    solve();
  }
}
