import collections
def main():
    n = int(input())
    a = list(map(int,input().split()))
    cnt = collections.Counter(a)
    num = len(set(a))
    if n % 3 != 0:
        print('No')
        return
    if num != 3 and cnt.most_common()[0][1] !=3 and cnt.most_common()[-1][1] != 3:
        print('No')
        return
    print('Yes')

if __name__ == '__main__':
    main()
