#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int MAXN = 1000010;
int arr[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  int cnt = 0;
  for (int i = 1; i < n - 1; i++) {
    if (arr[i] != arr[0] && arr[i] != arr[n - 1]) cnt++;
  }
  cout << cnt << endl;
  return 0;
}
