N = int(input())
a = list(map(int,input().split()))

a.sort()
import collections

count = collections.Counter(a)
modulo = (N%3)

L = len(count)

if modulo == 0:
    if L < 4:
        ans = 'Yes'
    else:
        ans = 'No'
else :
    if L < 2:
        ans = 'Yes'
    else:
        ans = 'No'
    
print(ans)