import math import sys def S(): return sys.stdin.readline().rstrip() def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int, sys.stdin.readline().rstrip().split()) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LS(): return list(sys.stdin.readline().rstrip().split()) n = I() d = {} for i in range(n): s = S() if s in d: d[s] += 1 else: d[s] = 1 if n%2 == 0: if max(d.values()) > n//2: print("NO") else: print("YES") else: if max(d.values()) > n//2 + 1: print("NO") else: print("YES")