# coding: utf-8 # Here your code ! input() nums = list(map(int, input().split())) nums_uniq = list(set(nums)) flag = False nums.sort() nums_uniq.sort() if nums == nums_uniq: diff=abs(nums[0]-nums[1]) curNum=nums[1] flag = True for i in nums: if abs(curNum-i)==diff: curNum = i else: flag=false break if flag: print("YES") else: print("NO")