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