#include <bits/stdc++.h>
using namespace std;
map<int, int> Map;
int main() {
  int n;
  cin >> n;
  int N = n;
  set<int> s;
  while (n--) {
    int x;
    scanf("%d", &x);
    Map[x]++;
  }
  auto it = Map.end();
  it--;
  int ans = N - it->second;
  it = Map.begin();
  ans -= it->second;
  cout << max(0, ans) << endl;
}
