n = input() kamo_list = sorted(list(map(int, input().split(' ')))) equal_interval = 'YES' diff = kamo_list[1] - kamo_list[0] if diff == 0: equal_interval = 'NO' for i in range(2,len(kamo_list)): if kamo_list[i] - kamo_list[i-1] != diff: equal_interval = 'NO' print(equal_interval)