#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000000000000000ll;
const long long MOD = 1000000007ll;
const double EPS = 1e-8;
int main(void) {
  int n;
  cin >> n;
  vector<int> a;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    a.push_back(t);
  }
  sort(a.begin(), a.end());
  int mi = a[0];
  int ma = a[n - 1];
  long long ans = 0;
  for (int i = 0; i < a.size(); i++) {
    if (a[i] == mi || a[i] == ma) continue;
    ans++;
  }
  cout << ans << endl;
  return 0;
}
