Yaroslav has an array that consists of *n* integers. In one second Yaroslav can swap two neighboring array elements. Now Yaroslav is wondering if he can obtain an array where any two neighboring elements would be distinct in a finite time.

Help Yaroslav.
The first line contains integer *n* (1 ≤ *n* ≤ 100) — the number of elements in the array. The second line contains *n* integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 1000) — the array elements.
x=[]
n=[]
u=0
a=0
t=0
c=int(input())
z=list(map(int,input().split()))
for b in z:
    if b not in x:
        x.append(b)
for m in x:
    n.append(z.count(m))        
n.sort(reverse=True)
#print('n=',n)
z=n[0]
for i in range(len(n)):    
#    print('zzzzzzz=',z)
#    print('aaaaaaaa=',a)
#    print('index of i====',u)
    if z-a==1 or z-a==0:
        if u==len(n)-1:
           # print('ttttt')
            break        
        z=n[i+1]
        a=0
    else:
        if u==len(n)-1:
          #  print('rrrrrrrrrr')
            break
        a+=n[i+1]
    u+=1
#print('z=',z)
#print('a=',a)
if  z-a==1 or z-a==0:
    print('YES')
    
else:
    print('NO') 
