#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int a[n], i, j, k, min, max;
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  for (i = 0; i < n; i++) {
    if (i == 0) {
      min = a[i];
      max = a[i];
    } else {
      if (a[i] < min) min = a[i];
      if (a[i] > max) max = a[i];
    }
  }
  if (max == min) {
    printf("0");
    return 0;
  }
  int cou = 0;
  for (i = 0; i < n; i++) {
    if (a[i] > min && a[i] < max) cou++;
  }
  printf("%d", cou);
}
