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