#include <bits/stdc++.h>
using namespace std;
int n, a, mx, mn;
int mx_cnt, mn_cnt;
int main() {
  cin >> n >> mx;
  mn = mx;
  mx_cnt = 1;
  for (int i = 1; i < n; i++) {
    cin >> a;
    if (mn == mx) {
      if (a == mx)
        mx_cnt++;
      else if (a > mx) {
        mx = a;
        mn_cnt = mx_cnt;
        mx_cnt = 1;
      } else {
        mn = a;
        mn_cnt = 1;
      }
    } else {
      if (a > mx) {
        mx = a;
        mx_cnt = 1;
      } else if (a == mx)
        mx_cnt++;
      else if (a < mn) {
        mn = a;
        mn_cnt = 1;
      } else if (a == mn)
        mn_cnt++;
    }
  }
  cout << n - mn_cnt - mx_cnt;
}
