N = int(input())
nums =list(map(int, input().split()))
a = {}
INF = 10**5
for num in nums:
  if not num in a:
    a[num] = 1
  else:
    a[num] += 1
  if len(a) > 3:
    print('No')
    exit()
if len(a) >= 2:
  max_v = 0
  min_v = INF
  for v in a.values():
    max_v = max(max_v, v)
    min_v = min(min_v, v)
  if max_v == min_v:
    print('Yes')
  else:
    print('No')
else:
  print('No')