from collections import Counter n=int(input()) a=[] for i in range(n): a.append(input()) p=Counter(a) q=max(p.values()) ans=n-q if ans