#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, res = 0, min = 1000000001, max = -1;
  cin >> n;
  int a[n];
  set<int> s;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > max) max = a[i];
    if (a[i] < min) min = a[i];
    s.insert(a[i]);
  }
  if (s.size() <= 2) {
    cout << 0 << endl;
    return 0;
  }
  v.insert(v.begin(), min);
  for (int i = 0; i < n; i++)
    if (a[i] != max && a[i] != min) v.push_back(a[i]);
  v.push_back(max);
  sort(v.begin(), v.end());
  for (int i = 1; i < v.size() - 1; i++) {
    if (v[i] >= v[i - 1] && v[i] <= v[i + 1]) res++;
  }
  cout << res << endl;
  return 0;
}
