#include <bits/stdc++.h>
using namespace std;
const long long MX = 2e5 + 5;
const long long INF = 1e18;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long x = *max_element(a, a + n);
  long long cnt{0};
  for (long long i = 0; i < n; i++) {
    if (a[i] != x) {
      cnt++;
    }
  }
  cout << cnt << "\n";
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
  return 0;
}
