#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)1e5 + 12;
int a[maxn], n;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  int cnt = 0;
  for (int i = 2; i < n; i++) {
    if (a[1] < a[i] && a[i] < a[n]) cnt++;
  }
  cout << cnt;
}
