#include <bits/stdc++.h>
using namespace std;
int main() {
  int count = 0;
  int n;
  int t = 0;
  cin >> n;
  vector<int> a;
  for (int i = 0; i < n; i++) {
    cin >> t;
    a.push_back(t);
  }
  sort(a.begin(), a.end());
  int max = a.size() - 1;
  for (int i = 1; i < a.size() - 1; i++) {
    if (a[0] < a[i] && a[i] < a[max]) {
      count++;
    }
  }
  cout << count << endl;
}
