#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  if (n <= 2) {
    cout << 0 << endl;
  } else {
    sort(a, a + n);
    int max = a[n - 1];
    int min = a[0];
    int c = 0;
    for (int i = 1; i < n - 1; i++) {
      if (a[i] > min && a[i] < max) c++;
    }
    cout << c << endl;
  }
  return 0;
}
