#include <bits/stdc++.h>
using namespace std;
int main() {
  int ara[100002];
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &ara[i]);
  sort(ara, ara + n);
  int i = 0, low = 0, high = 0;
  while (ara[i] == ara[0] && i < n) {
    low++;
    i++;
  }
  i = n - 1;
  while (ara[i] == ara[n - 1] && i >= 0) {
    high++;
    i--;
  }
  if (n - low - high < 0)
    cout << 0 << endl;
  else
    cout << n - low - high << endl;
  return 0;
}
