#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j = 0, e = 0, k = 0, m;
  cin >> n;
  long long int a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  for (i = 0; i < n - 1; i++) {
    if (a[i] == a[i + 1]) e++;
  }
  for (i = 0; i < n; i++) {
    if (a[i] == a[0]) j++;
    if (a[i] == a[n - 1]) k++;
  }
  if (n == 2 || n == 1)
    cout << "0";
  else if (e == n - 1)
    cout << "0";
  else {
    m = n - k - j;
    cout << m;
  }
  return 0;
}
