#include <bits/stdc++.h>
using namespace std;
int a[100010];
int main() {
  int n;
  cin >> n;
  if (n == 1) {
    cout << 0;
    return 0;
  }
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  if (a[0] == a[n - 1]) {
    cout << 0;
    return 0;
  }
  int ans = n - 2;
  for (int i = 1; a[i] == a[i - 1]; i++) ans--;
  for (int i = n - 2; a[i] == a[i + 1]; i--) ans--;
  cout << ans;
  return 0;
}
