#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c, d, i, j, k, l, n, arr[100001], Min, Max, _count = 0;
  cin >> n;
  for (int i = (int)0; i < int(n); i++) cin >> arr[i];
  sort(arr, arr + n);
  Min = arr[0];
  Max = arr[n - 1];
  for (int i = (int)0; i < int(n); i++) {
    if (arr[i] > Min && arr[i] < Max) _count++;
  }
  cout << _count << endl;
  return 0;
}
