#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  long long b[100000], c = 0;
  cin >> a;
  for (int i = 0; i < a; i++) {
    cin >> b[i];
  }
  sort(b, b + a);
  c = 0;
  for (int i = 0; i < a; i++) {
    if (b[0] != b[i] && b[i] != b[a - 1]) c++;
  }
  cout << c;
}
