import std.stdio;
import std.algorithm;
import std.conv;
import std.string;
import std.math;

void main(string[] args)
{
	auto n = to!int(strip(readln));
	int[1001] a;
	auto x = split(strip(readln));
	foreach (j; 0 .. n)
	{
		 a[to!int(x[j])]++;
	}
	
	int count;
	int ze = s(a);
	while(ze >= 1)
	{
		count +=  ze - 1;
		ze = s(a);
	}

	writeln(count);
}
int s(int[] a)
{
	int count;
	foreach (i, val ; a)
	{
		if (val >= 1)
			count++;
		a[i]--;
	}
	return count;
}