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