def main(): N = int(input()) x = list(map(int, input().split())) x.sort() dif = [] for i in range(N-1): dif.append(x[i+1] - x[i]) for j in range(len(dif)-1): if dif[j]!=dif[j+1]: return print('NO') return print('YES') if __name__ == '__main__': main()