#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<long long> arr(n);
  for (long long i = 0; i < n; i++) cin >> arr[i];
  sort(arr.begin(), arr.end());
  long long to_rem = 0;
  ;
  for (long long i = 0; i < n; i++) {
    if (arr[i] == arr[0] or arr[i] == arr[n - 1]) to_rem++;
  }
  cout << n - to_rem << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
