#include <bits/stdc++.h>
using namespace std;
int main() {
  map<int, int> mp;
  int n;
  cin >> n;
  int cnt = 0;
  int arr[n];
  int mn = INT_MAX;
  int mx = -1;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    mn = min(arr[i], mn);
    mx = max(mx, arr[i]);
  }
  for (int i = 0; i < n; i++) {
    if (arr[i] == mn) cnt++;
    if (mx != mn && arr[i] == mx) cnt++;
  }
  cout << n - cnt << endl;
  return 0;
}
