#include <bits/stdc++.h>
using namespace std;
long long int arr[123333];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  if (n <= 2) {
    cout << "0" << endl;
    return 0;
  }
  sort(arr, arr + n);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int lb = lower_bound(arr, arr + n, arr[i]) - arr;
    int up = upper_bound(arr, arr + n, arr[i]) - arr;
    if (lb != 0 && up != n) ans++;
  }
  cout << ans << endl;
  return 0;
}
