#include <bits/stdc++.h>
using namespace std;
int n, mn = 999999999, x = 1, mx, y = 1, s;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &s);
    if (s == mn) x++;
    if (s < mn) {
      mn = s;
      x = 1;
    }
    if (s == mx) y++;
    if (s > mx) {
      mx = s;
      y = 1;
    }
  }
  printf("%d\n", max(0, n - (x + y)));
}
