N = int(input()) A = list(map(int, input().split())) num = A.count(0) s = set(A) A.sort(reverse = True) d = 10**16 for i in range(N-1): if A[i+1] == 0: break tmp = A[i] - A[i+1] d = min(tmp, d) if num >= N-1: ans = "Yes" elif d == 0: if (0 in s and len(s) == 2) or len(s) == 1: ans = "Yes" else: ans = "No" else: ans = "Yes" for i in range(N-1): if A[i+1] == 0: break diff = A[i] - A[i+1] if diff == d: continue if diff%d != 0: ans = "No" elif diff%d == 0: num -= diff//d - 1 if num < 0: ans = "No" print(ans)