#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k = 0, m, z = 1;
  cin >> n;
  long long a[n + 2], c[n + 2], b[n + 2];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  if (n == 1 || n == 2) {
    cout << 0;
    return 0;
  }
  sort(a + 1, a + n + 1);
  if (a[1] == a[n]) {
    cout << 0;
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    if (a[1] == a[i]) k++;
    if (a[n] == a[i]) k++;
    z *= a[i];
  }
  cout << n - k;
  return 0;
}
