#include <bits/stdc++.h>
using namespace std;
vector<int> st;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int maxst = 0, minst = 1e9;
  for (int i = 0; i < int(n); i++) {
    int a;
    cin >> a;
    maxst = max(maxst, a);
    minst = min(minst, a);
    st.push_back(a);
  }
  int res = 0;
  for (int i = 0; i < int(n); i++) {
    if (st[i] != maxst && st[i] != minst) res++;
  }
  cout << res << '\n';
  return 0;
}
