#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, ans = 0;
  cin >> n;
  long long arr[n + 2], mn = 1e9, mx = -1;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    mn = min(arr[i], mn);
    mx = max(arr[i], mx);
  }
  for (int i = 0; i < n; i++) {
    ans += (arr[i] > mn && arr[i] < mx) ? 1 : 0;
  }
  cout << ans;
  return 0;
}
