#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> stwrds;
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    stwrds.push_back(x);
  }
  sort(stwrds.begin(), stwrds.end());
  int l = 0;
  for (int i = 1; i < (stwrds.size()) - 1; i++) {
    if (stwrds[i] > stwrds[0] && stwrds[i] < stwrds[n - 1]) {
      l++;
    }
  }
  printf("%d\n", l);
  return 0;
}
