n = int(input()) t = list(map(int,input().split())) d = dict() for i in t: if i in d: d[i] += 1 else: d[i] = 1 k = [d[i] for i in d] k.sort(reverse=True) s = sum(k) ans = 0 j=0 while s>0: ans+=1 s = s - 2*k[j] + 1 j += 1 print(ans)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | n = int(input()) t = list(map(int,input().split())) d = dict() for i in t: if i in d: d[i] += 1 else: d[i] = 1 k = [d[i] for i in d] k.sort(reverse=True) s = sum(k) ans = 0 j=0 while s>0: ans+=1 s = s - 2*k[j] + 1 j += 1 print(ans) |