a = int(input())
x = list(map(int,input().split()))
def Y(a,t = 0):
    if a==t : print('YES')
    else : print('NO')
def y(a, t =0):
    if a==t : print('Yes')
    else : print('No')
t = (len(x) == x.count(1) + x.count(2) + x.count(3)) * (x.count(1) == x.count(2) and x.count(2) == x.count(3)) + (sum(x) == 0)

y(1,t)