#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 55;
const int inf = 1e9 + 77;
const int MOD = 1e9 + 7;
const double PI = 3.14159265359;
const double eps = 0.0000001;
int a[MAX];
int n;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  sort(a, a + n);
  int res = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i] != a[0] && a[i] != a[n - 1]) ++res;
  }
  cout << res;
  return 0;
}
