N = int(input()) l = sorted(list(map(int, input().split()))) d = [0]*(N-1) for i in range(N-1): d[i] = l[i+1]-l[i] print("YES" if len(set(l))!=1 and len(set(d))==1 else "NO")