#include <bits/stdc++.h>
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
const int MOD = 1e12 + 7;
const int MAX = 1e6 + 2;
const int INF = 0x3f3f3f3f;
using namespace std;
int main() {
  long long n, sum = 0;
  static int a[100001];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long Min = *min_element(a, a + n);
  long long Max = *max_element(a, a + n);
  for (int i = 0; i < n; ++i) {
    sum += (a[i] != Min && a[i] != Max);
  }
  cout << sum << endl;
  return 0;
}
