from collections import Counter def main(): etos = [input() for _ in range(int(input()))] counter_eto = Counter(etos) if max(counter_eto.values()) > (len(etos) + 1) // 2: print("NO") else: print("YES") if __name__ == "__main__": main()