#include <bits/stdc++.h>
using namespace std;
int v[100005];
int main() {
  long long n, i, x, a = 9999999999, b = -1, ans = 0;
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (i = 1; i <= n; ++i) {
    cin >> v[i];
    if (v[i] < a) a = v[i];
    if (v[i] > b) b = v[i];
  }
  for (i = 1; i <= n; ++i)
    if (v[i] > a && v[i] < b) ++ans;
  cout << ans;
  return 0;
}
