import math n = int(input().strip()) arr = {} for i in range(n) : eto = input().strip() if eto not in arr : arr[eto] = 1 else : arr[eto] += 1 max_num = max(arr.values()) if max_num <= math.floor((n+1)/2) : print("YES") else : print("NO")