#include <bits/stdc++.h>
using namespace std;
void sallam() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
int SallamBinarySearch(int list[], int key, int sizeofarray) {
  int low = 0;
  int high = sizeofarray - 1;
  while (high >= low) {
    int mid = (low + high) / 2;
    if (key < list[mid]) {
      high = mid - 1;
    } else if (key == list[mid]) {
      return mid;
    } else {
      low = mid + 1;
    }
  }
  return -1;
}
int main() {
  sallam();
  int n, mn = INT_MAX, counter = 0, mx = INT_MIN;
  cin >> n;
  vector<int> arr(n);
  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) && (arr[i] != mx)) {
      ++counter;
    }
  }
  cout << counter << endl;
}
