from collections import * n=int(input()) d=defaultdict(int) for i in [0]*n:d[input()]+=1 print(n+1>>1) print("YES"if max(d.values())<=n+1>>1 else"NO")