N = int(raw_input()) input = sorted(map(int, raw_input().strip().split())) cnt = 0 top = input.pop() nxt = input.pop() while True: if top == nxt: while top == nxt: if len(input) == 0: break nxt = input.pop() else: cnt += 1 top = nxt nxt = input.pop() print cnt