#include <bits/stdc++.h>
using namespace std;
inline long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
inline bool prime(long long a) {
  if (a == 2) return true;
  if (a % 2 == 0) return false;
  for (long long i = 3; i <= sqrt(a); i++) {
    if (a % i == 0) return false;
  }
  return true;
}
bool prim[(int)1e5];
void seive() {
  for (int i = 0; i < (int)1e5; i++) prim[i] = true;
  prim[0] = prim[1] = false;
  for (int i = 2; i < (int)1e5; i++) {
    for (int j = 2 * i; j < (int)1e5; j += i) prim[i] = false;
  }
}
int power(int x, unsigned int y, int p) {
  int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int c = n - 2;
  int i = 1;
  while (a[i] == a[0] && i < n) {
    i++;
    c--;
  }
  if (i >= n) {
    cout << 0;
    return 0;
  }
  i = n - 2;
  while (a[i] == a[n - 1] && i >= 0) {
    i--;
    c--;
  }
  cout << c << endl;
}
