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.
n = int(input())
l = list(map(int,input().split()))
freq = dict()
for e in l:
    if e in freq:
        freq[e] += 1
    else:
        freq[e] = 1

sorted_freq = sorted([[k,v] for k,v in freq.items()],key = lambda x:-x[1])
n_freq = len(sorted_freq)
no_neigh = [0] * n
cur_elem = 0
cur_neigh = 0
visited = 0

while visited != n:
    #print(cur_elem)
    if sorted_freq[cur_elem][1] != 0:
        no_neigh[cur_neigh] = sorted_freq[cur_elem][0]
        sorted_freq[cur_elem][1] -= 1
        cur_neigh += 1
        visited += 1
    cur_elem = (cur_elem + 1) % n_freq

#print(no_neigh)
is_no_neigh = True
for i in range(1,n):
    if no_neigh[i] == no_neigh[i - 1]:
        is_no_neigh = False
        break

print('YES' if is_no_neigh else 'NO')



