#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, M = 2e6 + 5, INF = 1e9, mod = 1e9 + 7;
const long long linf = 1e18;
const double eps = 1e-8, pi = acos(-1);
inline int gmin(int &a, int b) {
  if (a > b) a = b;
}
inline long long gmin(long long &a, long long b) {
  if (a > b) a = b;
}
inline int gmax(int &a, int b) {
  if (a < b) a = b;
}
inline long long gmax(long long &a, long long b) {
  if (a < b) a = b;
}
inline void read(long long &x) {
  long long f = 1, t = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    t = t * 10 + ch - '0';
    ch = getchar();
  }
  x = t * f;
}
inline long long read(long long &x, long long &y) {
  read(x);
  read(y);
}
inline void read(int &x) {
  int f = 1, t = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    t = t * 10 + ch - '0';
    ch = getchar();
  }
  x = t * f;
}
inline int read(int &x, int &y) {
  read(x);
  read(y);
}
inline void read(int &a, int &b, int &c) {
  read(a);
  read(b);
  read(c);
}
inline void read(long long &a, long long &b, long long &c) {
  read(a);
  read(b);
  read(c);
}
inline int read() {
  int x;
  read(x);
  return x;
}
inline long long qpow(long long a, long long b, long long p) {
  long long ret = 1;
  for (; b; b >>= 1, a = a * a % p)
    if (b & 1) ret = ret * a % p;
  return ret;
}
inline long long qpow(long long a, long long b) {
  long long ret = 1;
  for (; b; b >>= 1, a = a * a % mod)
    if (b & 1) ret = ret * a % mod;
  return ret;
}
inline long long qmul(long long a, long long b, long long p) {
  long long ret = 0;
  for (; b; b >>= 1, a = (a << 1) % p)
    if (b & 1) {
      ret = ret + a;
      if (ret >= p)
        ret -= p;
      else if (ret < 0)
        ret += p;
    };
  return ret;
}
inline long long qmul(long long a, long long b) {
  long long ret = 0;
  for (; b; b >>= 1, a = (a << 1) % mod)
    if (b & 1) {
      ret = ret + a;
      if (ret >= mod)
        ret -= mod;
      else if (ret < 0)
        ret += mod;
    };
  return ret;
}
inline void judge() {
  freopen("data.in", "r", stdin);
  freopen("data.out", "w", stdout);
}
inline void gen() { freopen("data.in", "w", stdout); }
int n, m, bin[30] = {1};
int a[N];
int main() {
  read(n);
  for (int i = (1); i <= (n); i++) read(a[i]);
  sort(a + 1, a + 1 + n);
  int ans = 0;
  for (int i = (1); i <= (n); i++)
    if (a[i] > a[1] && a[i] < a[n]) ans++;
  cout << ans << endl;
}
