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