#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000;
int a[maxn];
int main() {
  int n;
  while (~scanf("%d", &n)) {
    memset(a, 0, sizeof(a));
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    sort(a + 1, a + 1 + n);
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      if (a[i] == -1) continue;
      int flag = 0;
      int temp = a[i];
      for (int j = i + 1; j <= n; j++) {
        while (temp == a[j] || a[j] == -1) {
          j++;
        }
        if (j <= n) {
          temp = a[j];
          a[j] = -1;
          flag = 1;
          ans++;
        }
      }
      if (!flag) break;
      a[i] = -1;
    }
    cout << ans << endl;
  }
  return 0;
}
