#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, s = 0;
  int arr[n];
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  for (int i = 0; i < n - 1; ++i)
    if (arr[n - 1] - arr[i] > 0) s++;
  cout << s;
  return 0;
}
