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