<span style="font-family: Arial, Helvetica, sans-serif;">// author : Anjone</span>
// source : http://codeforces.com/problemset/problem/651/B
// time : 2016-4-5 19:28:24
// *******************************************************
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<math.h>
#include<map>
using namespace std;
#define MAXN 100005
#define Min(_,__) _<__?_:__
#define rep(_,__,___) for(int _=__;_<___;_++)
#define S(_) scanf("%d",&_);
#define P(_) printf("%d\n",_);
#define Pl(_) printf("%lld\n",_);
#define ll long long
int main()
{
int h[1005] ={0} , n , ans = 0 ,a,pre=1001;
S(n)
rep(i,0,n){
S(a)
h[a]++;
if(pre>a) pre=a;
}
rep(i,pre+1,1001){
if(h[i]){
ans+=Min(h[i],h[pre]);
if(h[i]<h[pre]) h[i] = h[pre];
pre = i;
}
}
P(ans)
}