#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  deque<int> s;
  for (int i = 0; i < n; i++) {
    int z;
    cin >> z;
    s.push_back(z);
  }
  sort(s.begin(), s.end());
  int counter = 0;
  int x = s[0];
  int y = s[s.size() - 1];
  for (int i = 0; i < n; i++) {
    if (s[i] == x || s[i] == y) {
      continue;
    }
    counter++;
  }
  cout << counter;
  return 0;
}
