#include <bits/stdc++.h>
const int INF = (int)1e9 + 10;
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> nums(n);
  for (int i = 0; i < n; i++) cin >> nums[i];
  sort(nums.begin(), nums.end());
  int ans = n, first = nums[0], last = nums[n - 1];
  for (int i = 0; i < n; i++)
    if (nums[i] == first || nums[i] == last) ans--;
  cout << ans;
  return 0;
}
