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