#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7, SZ = 1e5 + 5;
int dx[4] = {-1, 0, 0, 1};
int dy[4] = {0, -1, 1, 0};
int dxx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int dyy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
set<int> s;
map<int, int> tb;
int main() {
  int i, j, n, sum = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> j;
    s.insert(j);
    tb[j]++;
  }
  set<int>::iterator it = s.begin();
  it++;
  for (j = 1; (j + 1) < s.size(); j++, it++) {
    sum += tb[*it];
  }
  cout << sum << endl;
  return 0;
}
