#include <bits/stdc++.h>
using namespace std;
int n, cnt, x[100001];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> x[i];
  sort(x, x + n);
  for (int i = 0; i < n; i++) {
    if (x[i] != x[0] && x[i] != x[n - 1]) cnt++;
  }
  if (n == 1)
    cout << 0;
  else
    cout << cnt;
  return 0;
}
